> zur Navigation > zum Inhalt

Scripting Corner

view source code

Purpose

The purpose of this script is the simple task of creating a thumbnail overview of a directory on a web server containing images. It should be used as an index document for this directory hence must be named "index.php" prior use. Also for creating thumbnails some PHP functions relying on the GD library are used so make sure your PHP version supports those functions.

Configuration

The script supports caching in two ways: First it supports browser caching of the created thumbnails so that thumbnails only have to be created once for the same directory and browser session. Also you can cache the created thumbnails themselves in a subdirectory. The directory's name defaults to ".thumbs" but can be customized. For caching the thumbnails on the server you need write privileges on the directory.
You can also customize the size of the created thumbnails. It defaults to 100×100 pixels. For optical reasons thumbnails will always be squares. However if the images have different aspect ratios the crop area for the thumbnails will be chosen semi-intelligently.
Last but not least you can of course customize the output by using an HTML header and footer as indicated in the script. This way you can also include style sheets.

Demo

I use this script on my web servers for example for impressions from Warsaw or Berlin at night.