Amazon S3

Basically Amazon S3 behaves like local files. There is just on important difference. While thumbnails for local files are generated on demand, we need to calculate the thumbnails for images stored in an Amazon S3 bucked ahead. For this we use two buckets. One bucket contains the original files. The folder and file structure is the same like for local files. No nesting is supported. Place a folder in the bucket and upload your images in there. Example: event1/myimage.jpg. The second bucket is used to store the generated thumbnails in. You just need to create the bucket. Make sure you're using the same region for both buckets.

Once you uploaded your images to Amazon S3 and configured your buckets in the components options you need to let the database know about your new files. Use the Sync Database button and sync your folders to start the sync process. Once the new files appeared hit the Sync Files button to read in the necessary data. Check the Sync Database process documentation on how to generate thumbnails.

Always keep in mind that reading and writing to an Amazon S3 bucket is not for free. You have to pay for each request. So don't perform a sync or a thumbnail creation if it is not necessary.

Technical Details

The table #__eventgallery_file has two new fields: s3_etag and s3_etag_thumbnails. The field s3_etag contains the s3 hash of the orignal file. It is used to detect image changes. The field s3_etag_thumbnails contains a JSON object. It stores the thumbnail sizes and the hash values of each thumbnail. While creating the thumbnails this data is used to detect thumbnail changes. Once a change of the original file is detected, the field s3_etag_thumbnails is cleared. The next thumbnail creation run will find those thumbnails as missing and will recreate them. Make sure you uncheck the Refresh thumbnail hashes checkbox. Otherwise the s3_etag_thumbnails field will be populated with the hash values of existing thumbnails.

Amazon S3 Thumbnail Creator

Quick Steps

  • Create two buckets in the region you like. One will contain the original files, the other the resized thumbnails.
  • Change permisions for the bucket with the resized images to public.
  • Create a new user in IAM. This will help to restrict access to the buckets only
  • Create a new policy. You can use the json example below. Just replace the names of the buckets.
  • Assign the policy to the user
  • Configure Event Gallery with the user data, region and bucket information.
  • Upload your images in a simple folder structure. Not nesting! folder/image.jpg
  • Use the Sync Database process to detect the new files
  • Run the Amazon S3 thumbnail creator to generate the thumbnails

Access Policy

You need to specify credentials so Event Gallery can access the S3 buckets you created. The following policy allows to read and write in those buckets. You just need to change the names of those buckets.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:ListBucket"
            ],
            "Resource": [
                "arn:aws:s3:::eventgallery-images-test-original",
                "arn:aws:s3:::eventgallery-images-test-resized"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:PutObject",
                "s3:PutObjectAcl",
                "s3:GetObject",
                "s3:DeleteObject"
            ],
            "Resource": [
                "arn:aws:s3:::eventgallery-images-test-original/*",
                "arn:aws:s3:::eventgallery-images-test-resized/*"
            ]
        }
    ]
}
         
Alle Preise inkl. Mwst. , zzgl. Versand