Fix crash when uploading an associated images to S3.

Fix crash when uploading an associated template image to S3.
Added a extra config parameter to allow specifying the amazon s3 end point for storage space in different regions.
Allow creation of custom images sizes when using S3 storage.