Sometimes our applications uses different image sizes for movie posters and grids in general that are not supported by the clients API.
This is a solution that allow you to generate thumbnails and cache them.
Timthumb is an opensource solution to resize images, and it works very good, but it has a problem, Timthumb cache is not that good and stores image cache inside a text file, and it requires to execute the timthumb script everytime the user is requesting for an image.
So, this is a modified version of timthumb script, to save the generated thumbnails in a physical location as an image, not as a txt file.
And everytime when a user request for a thumbnail, it goes to the Nginx controller to check if the file / image already exists in the physical location, much more faster than doing a request to the timthumb PHP script, and only if the thumb have not been generated, nginx calls timthumb script to generate the cached thumbnail only once.
Plus, I use Amazon CloudFront as an extra cache level on the top.