Red Queen Review Engine User Manual

CONFIGURATION -- Thumbnails

Adjust Text:  a a a a
« Table of Contents   |   Obtain Red Queen »


CONFIGURATION

Thumbnails

Thumbnailing, provided that it has been enabled, is an automated process in Red Queen. Images which are thumbnailed are those that are uploaded because they represent the "value" associated with a database table column which is of the UPLOAD variety.

As an example, the Member table has a column named avatar_image. The Member.avatar_image column is in fact an INT (integer) column which keys into the Upload table. Although it is an INT column, the Form Type of the Member.avatar_image column is PUBLIC_IMAGE. This means the uploaded file is assumed to be an image and a thumbnail is created and stored in the same directory as the unscaled image at the time the file is uploaded. In fact there are 2 specific Form Types which can represent an uploaded image file: the PUBLIC_IMAGE type, and the PRIVATE_IMAGE type--the latter of which can only be viewed by registered members.

Image Manipulation Libraries

In order to perform the thumbnailing, Red Queen needs to be able to call upon a compiled image manipulation library which will read the original image file and produce a scaled version. There are 3 libraries which Red Queen is designed to interact with: Image Magick, GD, and NetPBM. Each of these is discussed in more detail below. Which one you should use will depend upon what is available on your web server, or what you can install on it yourself, and the upon the limitations of the individual libraries. Unless your web host has provided one of these image libraries for you, you will either have to install the library yourself (generally difficult unless you can obtain the pre-compiled binaries) or disable the thumbnailing capability altogether.

  • Image Magick

    The first of the 3 possible image scaling libraries you might use is Image Magick--a Perl module which offers image scaling capabilities for a large number of image file formats. However, Image Magick is not widely supported by web hosts so you may have to install it yourself (not very easy) or look at the other 2 library possibilities. Red Queen will check whether Image Magick is available and report this on the Thumbnails frame. If you do not have it and want to use it, ask your web host whether they might install it before you spend time trying to figure out whether you can install it yourself. Otherwise investigate the next two image manipulation library alternatives...

  • GD

    The second possible image scaling library you might have access to is GD--Lincoln Stein's Perl interface to Thomas Boutell's libgd library. This library is supported by quite a few web hosts. Red Queen will check whether GD is available and report this on the Thumbnails frame.

    Note on GIF support: Because Unisys owned the patent on the LZW compression scheme which forms the basis of the GIF image format, and because Unisys has sought royalties from those using its algorithm, support for GIF images was removed from the GD interface and the libgd library. The patent has since expired, but whether or not any GD installation you might have on your system currently supports GIF will depend on whether you have GD 1.19 or an earlier version, or GD 2.15 or a later version. Versions of GD between 1.19 and 2.15 do not support GIF. If your version falls into the blacklist and you cannot get by without GIF support you should look at using either Image Magick or NetPBM.

    You can test which of the common image formats, GIF, JPEG, PNG, can be thumbnailed by locating the large test images near the bottom of the Thumbnails frame and clicking on the thumbnailing links beside them. If you attempt to thumbnail the GIF image and the GD library does not support the GIF format you will get an error message like:

    Image cannot be thumbnailed. GD library attempted but returned no blob.
  • NetPBM

    The final image scaling library, which you almost certainly will be able to use for thumbnailing, is known as NetPBM. This library consists of a series of executable programs that convert an image file from one format into another, or from one size into another (which is what we need to do thumbnailing).

    Ask your web host for the path to the NetPBM utilities on your system. You will need to supply this path as a Red Queen configuration variable on the Thumbnails frame. But don't despair if you do not currently have NetPBM available, because you can probably obtain the pre-compiled binaries for this library and simply upload them to your web server yourself. For more information about the library see the homepage for NetPBM.

    Perhaps of more interest, however, is the homepage for Gallery, where you may be able to find the NetPBM binaries for your server type. Look for the relevant NetPBM archive, download and unpack, then create a directory somewhere on your web server named /netpbm and upload the executable files into it. You will then need to supply the path to this NetPBM bin as a Red Queen configuration variable on the Thumbnails frame.

    If you do use the NetPBM library you should get support for the GIF, JPEG, PNG, and TIFF image formats. Also, if you have the Perl IPC::Run module installed you can activate this from the Thumbnails frame in order to speed the Red Queen / NetPBM interaction. However, IPC::Run may or may not work as expected on your system (it did not when tested on the Red Queen development server) so you might have to disengage IPC::Run and use plain system calls to execute the NetPBM programs. This is usually not a big deal as file uploads are performed rather infrequently on most web sites.

Sizing Options

If you have thumbnailing enabled you will want to be able to specify the size of the thumbnail images produced. Thumbnail size can be specified using one of four methods. You can provide a scale factor which represents either:

  1. the percentage size of the final thumbnail relative to the unscaled original, or
  2. the width of the final thumbnail (in pixels), or
  3. the height of the final thumbnail, or
  4. the side length of the bounding-square into which the image will be scaled to fit

You can also specify a cutoff size--so that any unscaled image whose largest dimension is already smaller than the cutoff will not be thumbnailed. The options discussed in this section are characterized by the following variables (plus example values):

thumbnail_scale_method

'final width' ( or 'final height' or 'percentage' or 'largest dimension')

thumbnail_scale_factor

100

thumbnail_cutoff_size

100

« Table of Contents   |   Obtain Red Queen »


Copyright © 2004 Random Mouse Software. All Rights Reserved.