Originally Posted by VIPStephan
There are some server side scripts that can do image manipulation on the server before the images are sent to the browser. You might wanna look into that if you need an uncomplicated way to shrink/crop many images regularly.
Yes, but this means that you have to resize the images each time. So now you put a larger load on the server for no good reason.
A reasonable implementation, though, would be to use a DB table to keep track of which images you have ALREADY resized in this way. If an image has not yet been resized, you do so right then and save the resized image in your /thumbnails directory and mark it as resized in the DB.
Or another way: Use 404 error handling. If a request for /thumbnails/image47.jpg comes in and the file is not found, have your 404 error handler find /images/image47.jpg, use the server side code to create the thumbnail, store it in the /thumbnails directory. and then redirect back to the thumbnail so the client-side code isn't even aware this has all happened.
However... Neither of the above allow you to custom crop the large image when creating the thumbnail. All they can do is shrink (and possible crop to a square image or whatever) in some generic way.