A simple library that can create thumbnails from various file types, by use
of ThumbnailProviders. Easily extendable with your own ThumbnailProviders.

Out of the box it can create thumbnails from Text files and image files as well as watermarked images. Also to add a provider just created a PHP class that implements IThumbnailProvider to add your own ThumbnailProvider.

ThumbnailProvider is easy to use, it’s as simple as this.

include "ThumbnailCreator.php";

$thumbCreator = new ThumbnailCreator();
$thumbCreator->createThumbnail("textfile.txt", "textFileThumb.png");
$thumbCreator->createThumbnail("imagefile.jpg", "imageFileThumb.jpg", 128, 128);

Change Log

Version 1.0 Released – 14 Oct 2010

Version 1.0.1 Released – 15 Oct 2010

  • Changed IThumbnailProvider::fromFile to IThumbnailProvider::create
  • Changed to leave image saving upto thumbnail provider, to allow for use of other image libs
  • Wrote documentaion, as you can see  :)
  • Added checks that width and height are actually numeric values
  • Added checks that the file in question actually exists
  • Scale Text thumbnails proportional to an 8.5×11 piece of paper.

Version 1.2 Release – 11 Nov, 2012

  • Changed ImageThumbnailProvider to use original dimensions when thumbnail dimensions are 0 or null
  • Added class GDThumnailProviderBase to hold basic methods when creating a provider that uses the GD library
  • Added class WatermarkThumbnailProvider to built-in providers
  • Added $useProvider arg to ThumbnailCreator::createThumbnail to use a specific provider when creating a thumbnail.
  • Changed font scaling for TextThumbnailProvider. Now scales to a 26 font equivalent on 8.5×11.
  • Added wordwrapping to TextThumbnailProvider as well as the propery $WordWrap, to en/disable.
  • Fixed an issue with width scaling in TextThumbnailProvider.


Author Image