I read a lot about dynamic image manipulation, storage and delivery of content, the company I'm working on already uses AWS for some of its services.
The application I'm working on saves document images in an S3 bucket (not limited to this), and I need to display them on demand.
The first version of this application stores images locally and performs image processing on demand on a single server.
Now the document storage has increased, and many images are saved, all through a web application, which means that one user can upload, say, 100 images, and the server must process them as quickly as possible.
That's why the images are loaded into the EC2 instance, and they are translated into the S3 bucket inside, since we save the original image in the first place, no thumbnails here to speed up the loading process.
Then another user may want to view these images or see them in their original size, so I need to re-size them dynamically, I will implement Cloudfront to cache the images after they are resized, and here's the problem.
The workflow is as follows:
1. User Request CDN image 2.a Cloudfront Serves the cached image 2.b Cloudfront request the image to a custom origin if its not cached 3. The origin server query S3 for the image 4.a If the image size exists on S3 5. Return the image to Cloudfront, Cache and return to user 4.b If the image size does not exists on S3 5. Generate a image size from the original S3 image 6. Save the new size to S3 7. Return the new size to Cloudfront, Cache and return to user
The user origin is responsible for creating the missing image size and saving it on S3, Cloudfront can use the cached image or request this new image size on S3 as it exists.
I think this is possible, since I already read a lot of documentation about this, but I still have not found documentation about who did this before.
This seems like a good way to process images, has anyone seen any documents on how to do this.
I am a PHP developer, but I could implement a non-PHP solution in favor of performance on the image server.