Note that this version of our web site is now obsolete. Instead, please bookmark https://hd.islandnet.com
Welcome to Islandnet.com  
Locally owned and operated since 1993  
Live Chat
LOG IN:  Username:    Password:    

Web Gadget: inThumb


inThumb is a gadget that displays a small "thumbnail" version of an image. It automatically resizes the image to the size you request, and optionally applies a border, outline, underlays, and overlays.


Current Version

2012-01-20 16:38:56 NEW

Download it now

Note that you can check the version of a web gadget by loading it directly in your browser with the "version" keyword. For example, loading "inthumb.php?version" will display the current version and tell you if there is a newer version available.


Installation

To install this web gadget, place a copy of inthumb.php in your web space. You can change the name to anything you'd like, as long as it ends with ".php". Note that this is an encoded and encrypted PHP file. It will look like gibberish to you, but the web server will know what to do with it. If you make any changes to this file it will cease to function, so be careful to upload it to your site in BINARY mode.


Configuration

When this web gadget runs it will expect to find a configuration file to load settings from. The filename depends on the name that you gave to the web gadget itself. If you named it "inthumb.php" then the configuration file must be named "inthumb_config.php" (that's an underscore in the middle). If you named it "tn.php" then the configuration file must be named "tn_config.php", and so on.

The configuration file is a PHP script that contains a list of values in the "CONFIG" array. It will look something like this (but normally with many more settings):

<?php
   $CONFIG['Size'] = 100;
   $CONFIG['Border'] = 1;
?>

Please note that this is a PHP file, and as such it must start with the <?php tag and end with the ?> tag and there must be nothing else before or after these tags and each setting must be terminated with a semicolon. String values need to be enclosed in quotes, numeric values do not need quotes. Putting any other PHP code in this file may cause the web gadget to function incorrectly.

Configuration Settings

$CONFIG['Size']
This controls the size of the generated thumbnail image. Either the height or the width (or both) of the thumbnail will be this long (in pixels).

$CONFIG['CacheDirectory']
This is the name of a directory where the web gadget can save copies of the generated thumbnails, which speeds things up significantly. The gadget is smart enough to know when an image has been updated, though, and a new thumbnail will be generated. This value must be set to a directory that exists and is writable, otherwise the web gadget will not run.

$CONFIG['CacheTime']
This controls how long cached thumbnails are kept. It can be 0 (zero) to keep them forever, but usually you would use something like "3 days" or "1 month" to keep your cache directory from growing indefinitely.


Usage:

For the following examples, we'll use "beach.jpg" as our image:

If we wanted to display a thumbnail version of this image that is no bigger than 100 pixels in width or height, we would invoke the thumbnail gadget like this:

<img src="inthumb.php?image=beach.jpg&size=100">

We could add a thin black line around it like this:

<img src="inthumb.php?image=beach.jpg&size=100&border=1">

Or a slightly thicker line in red:

<img src="inthumb.php?image=beach.jpg&size=100&border=4&bordercolor=FF0000">


Example:

To view the configuration file used in this example, click here.