PHP Thumb Generator 2011

First things first, I want to try and ensure every post on this blog is something interesting or creative.

This post is about a small script I threw together to create thumbnails of images.  Although this is not necessarily new or “creative”, I feel it deserves to be posted as it’s small and condensed.  Other scripts on Google are heavily outdated and a lot do not work.  The ones that do work contain workarounds that are not needed due to CSS3, or things you would never use (because we’re all Web 2.0 and all).

The script created does the following things

  • Can create thumbnail by width or height (it finds the correct dimension), or choose a custom width and height
  • Quality (1-100)
  • Output as a different format
  • Save the file as a new file (or overwrite)

It’s pretty basic, but it is essentially all you need.  I’ve uploaded it and it can be downloaded here.  Since WordPress is against files ending with certain extensions (namely zip files), remove the .txt extension from the file and it should work properly.

EDIT :

I’ve updated the script thanks to user pradip pointing out a problem. The script can be viewed here and downloaded here