Thumbnailer is a fast, easy to use image resizer script. It has many options you can tweak for the best results. This script also supports generation of dummy images.

Thumbnailer caches the generated image, that way you won't notice any difference between loading an image or a thumbnail. It has been tested in different sites and it lives up to its reputation!


  • Easy to use script, just upload it and link to it!
  • Easy to read code
  • Meny options to tweak
  • You can also use it without outputting the image
  • No performance/speed issues

How to use

First download the script and place it in the root of your server. Now it's ready to use!

Of cource you must tell the script which image to process. All the parameters are passed as $_GET parameters. This is how we pass image path to it:


Now it displays our image, but lets resize it!


That's it! You've got a working thumbnail. You can pass it into "src" of an image-tag or as background-image in css...


I'll explain most of the functions here.

Width (w)

Width, "w" (default "0"), is the maximum width that a thumbnail can be.


Height (h)

Height, "h" (default "0"), is the maximum height that a thumbnail can be.


Resize (resize)

Resize, "resize" (default "true"), controls the final dimensions of your thumbnail:
- if set to "true", the final image will be the same ratio as the original image.
- if set to "false", the final image will have the given dimensions.


Fill (fill)

Fill, "fill" (default "true"), is the same as crop. This only works if resize is set to false
- if set to "true", the image will be cropped and will fill the frame.
- if set to "false", the final image will not be cropped and you'll see the full image in the frame. Based on the image, there can be bars around the picture


Background (bg)

Background, "bg" (default "ffffff"), is the background color you'll see on the dummy image or if there are bars visible. You can pass short hex as parameter: "333"

Foreground, "fg" (default "eeeeee"), is the border color on the dummy image


Boldness (boldness)

Boldness, "boldness" (default "2"), is the stroke width. Only seen on a dummy image


Quality (quality)

Quality, "quality" (default "90"), is the .jpg quality. Change it if you want to save some bandwidth.


Enlarge (enlarge)

Enlarge, "enlarge" (default "true"), is the setting that prevents enlarging of small images if the dimensions of the thumbnailer are bigger. On the left the setting is set to "true", on the right to "false"


Scale (scale)

Scale, "scale" (default "1"), lets you specify the scale of the thumbnail. Useful for providing the user with image for high DPI screens. Note: there is a shortcut for providing the user with a double scale image: add @2x to the filename


Mirror (mirror)

Mirror, "mirror" (default ""), lets you mirror the image. You can pass "vertical", "horizontal" or "horizontal,vertical" ("vertical,horizontal" is the same)


Advanced options and tweaking

Default image (default)

Default image, "default" (default ""), is the default image that will be used if the image is not found.


Transparency (transparent)

Transparency, "transparent" (default "true"), is the .png image transparency. The bars around the image will be transparent too if set to true. Note: this only works if image type is .png!

Type (type)

Type, "type" (default ""), is the output image type. If set to "" (empty) the original type will be used.

Go ahead, inspect the image below, the output type is .png and it's transparent.


Cache time (cachetime)

Cache time, "cachetime" (default "7"), number of days the image will be cached on the client-side.


Position (position)

Position, "position" (default "center"), is the position of the image inside the thumbnails. Possible values: "left", "top", "center", "right", "bottom".


Download (download)

Download, "download" (default ""), is the file name that will be used when download is initiated. Click here to download the sample image.


Filter (filter)

Filter, "filter" (default ""), lets you apply one or multiple filters to the image.


Setting root and cache paths

Maybe you've noticed it already, but the thumbnailer.php is not located at my servers root. The cache path is also not in the root. They are both in this path: "/archive/thumbnailer/". This is how you set custom paths:

$root = realpath(getcwd().'/../../');
$cacheRelativePath = '/archive/thumbnailer/cache';
$thumb = new X_Image_Thumbnailer($_GET, $root, $cacheRelativePath);

Other settings

There are some other settings you can change in the code:
- You can temporary turn off caching
- You can change safe extensions if you want to


You can find the source code on Github.

Don't hesitate to read the code, you can find there some public methods you can use.


Any questions regarding bugs, requests and the source code itself should be asked on Github. Note: I will try to reply to all mails, but I can't promise anything

Download(v.: 1.0.19)

Current options

These are current options:

  • Basic:

    • Image path (img)
    • Width (w)
    • Height (h)
    • Resize (resize)
    • Fill (fill)
    • Background (bg)
    • Foreground (fg)
    • Stroke width (boldness)
    • Quality (quality)
    • Enlarge (enlarge)
    • Scale (scale)
    • Mirror (mirror)
  • Advanced:

    • Default image (default)
    • Transparency (transparent)
    • Image type (type)
    • Cache time (cachetime)
    • Position (pos)
    • Download name (download)
    • Filter (filter)

Make sure you read the documentation to know how to use these options!