Below are revisions for this snippet.

Creating Dynamic Image Thumbnail





Syndication

Revision Revison 1
Before any wars start, I want to clarify that the code below is NOT my own code, but unfortunately I am uncertain where I obtained it from. The code below basically create dynamic thumbnails of an image, you parse the following to it:

Image location,
Maximum Width
Maximum Height

It will then scale your image down, please do not confuse this with converting your image into a square, or whatever shape you are after. The code below will maintain aspect ratio of your image, and will use the values you parse as a guidline. Extremely handy when you are building gallery websites.