1. NOTICE: If you are using Fabrik and update to Joomla 3.10, you will need to update to Fabrik 3.10. And, if you are using Fabrik, do not upgrade to Joomla 4, we do not have a supported version ready for release. More information on a release date coming soon. Also, please note that Fabrik 3.10 will not install on any Joomla sites less than 3.8.
    Dismiss Notice

Fileupload via SDK to AWS-cloudfront

Discussion in 'About fabrikar.com' started by marozen, Dec 18, 2019.


How to set up upload-file from SDK > CDN-push > S3/image > thumbnailfunction > S3/resized > CDN-get?

  1. Posting usefull information about it and create a Wiki about the step by step instruction

  2. Create AWS-Cloudfront for push objects. Chance in fabrik fileupload the bucket name into the C-name

Multiple votes are allowed.
  1. marozen

    marozen Member

    Level: Community
    Uploading images via SDK to an AWS S3 bucket has many benefits. Fabrik offers successfully a method to upload images to S3 buckets. However, cropping and thumbnails are not succeeding in my case. I think that is also not the job of Fabrik to fix. Because that's being done by the Lambda function of Amazon. Further there are very important features that are required to get optimal benefits from SDK uploads:

    - Content Delivery Network for uploading (push) files to the S3
    Why? Because uploading via SDK is often slower that to your own server, because your own server is often in your region and the AWS region might be far away. But if you set up Cloudfront (CDN) for uploads (push) you will upload the file to the nearest server of the CDN. That goes much faster than your own server.

    - Ability to create thumbnails
    Why? Because uploaded images might be 10mb, which cost for some website visitors a lot of internet data, and loading time. IF you create your own templates for Fabrik lists, forms, and details you can easily display the thumbnail from any source. Thumbnails can be created with the lambda function.

    - CDN for displaying thumbnails
    After uploading an image via your website via SDK and via cloudfront to your S3-bucket there will be the lambda function that automatically creates a thumbnail in another S3-bucket. And that S3-bucket should also be in a cloudfront, but only for downloads. That makes your site running much faster and you will safe data.

    An example of what might happen is that person A uploads a photo in New Sealand. The photo in because of the CDN safed as a cache in New Sealand and then sent to the S3 bucket. Person B in England views that image, so it needs to load all the way from the S3-region first, but the Person C that is also in England that views the same page will load it from England because the cache of person B is safed by the CDN in England.

    Expected results of those 3 settings:
    - faster uploads
    - faster downloads

    How to set this up?
    Setting up such a structure is not so easy. I tried to create the thumbnail function on Lambda, but it gives errors when the image arrives in the path that fabrik puts them in via SDK. I'm trying, and if I succeed will update.

    Otherwise, it would be great if an expertised member of Fabrik or AWS can give an instruction because these expected results I guess are important.
  2. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Cropping and thumbnails work fine for me with S3. What problems are you having?

    -- hugh
  3. marozen

    marozen Member

    Level: Community
    Okay, I will check if it works. I also succeeded now with another Lambda function, but I prefer to handle thumbnails via Fabrik setting.

    But, I'm also trying to use AWS Cloudfront. I compared uploading an image to an S3 bucket and to filesystem. Filesystem is faster. Perhaps because my server is in Germany and the S3 bucket in Oregon. For GET requests I see that Cloudfront clearly works fast, but PUT doesn't. I read now something that might help:

    "If you want to submit PUT requests to CloudFront to upload files to your Amazon S3 bucket, you must add an x-amz-content-sha256 header to the request, and the header value must contain a SHA256 hash of the body of the request. For more information, see the documentation about the x-amz-content-sha256 header on the Common Request Headers page in the Amazon Simple Storage Service API Reference."

    Without Cloudfront perhaps the only reason to use AWS-SDK in fileuploads is to safe memory on your FTP. That's why I try to get PUT requests work on Cloudfront, then thumbnailing of images , and then GET requests of the Thumbnails.

    Right now I'm able to do thumbnailing via Lambda and GET requests of thumbnails over the Cloudfront Content Delivery Network, I just need to find out how to make uploads to edge-locations of the CDN.
  4. sunnyjey

    sunnyjey Active Member

    Level: Community

    I am too looking an alternative to load Fileupload S3 storage photos from AWS CloudFront. I have seen your site where photos from FabrikList are loading faster through CloudFront.

    Can you please share here how did you manage to use Fabrik + S3 + CloudFront. This would benefit to other Fabrik users also.
  5. marozen

    marozen Member

    Level: Community
    Here is a guideluine to have images on your website via cloudfrond CDN and to create thumbnails (cloudront, and lambda will be automatically intalled, you only need to have S3 bucket):


    For uploading files it doesn't work yet via cloudfront. Perhaps I need to define the right headers. It would indeed be faster to upload a file to the closest CDN server and then later that server will send it to the S3 bucket. I didn't succeed yet.
  6. sunnyjey

    sunnyjey Active Member

    Level: Community
  7. marozen

    marozen Member

    Level: Community
    Via that URL in Step1 there is a link to "Launch Solution". Then you have to select the same S3 bucket that you use with Fabrik's AWS SDK bucket. Cloudfront is the CDN of AWS, but that is only for the images or files from the S3 bucket. All the other content of my website is not with CDN, only the images.

    Then in your fabrik views template in the img tag you have to change the source of the image. with prefix of the cloudfront address instead of your own website and also with suffixing the filters that u can apply (see appendix D).
  8. marozen

    marozen Member

    Level: Community
    There is also an alternative for hosting photos. You can upload photos at Flickr, which goes through a fast CDN. And it handles your exif data properly (GPS-location, portrait/landscape orientation, date). And it also deals with your SEO, copyrights.

    If I upload a photo in a specific group it will automatically appear at my localhost test website. The URL of the photo and all the other details, such as title, gps, etc. will be stored in a json file. You can split and modify titles or descriptions to make your own autmatic json database.

    Flickr also offers you to upload photos via your own website to Flickr, but that requires an authentication process.

Share This Page