[ic] Multiple Images Support - Workable Solution

Paul Rogers paul at btsnet.co.uk
Thu Mar 3 06:42:42 EST 2005

Hi all,

After searching the mailing list for a solution for handling multiple images
I decided to put
together something that's easy to implement and doesn't require modifying
the existing admin UI.

The solution I've come up with allows just that and requires only a slight
modification to flypage.html:

[perl no_return=1]
$filename = [item-field image];
$Session->{mv_perl_result} = substr("$filename", 0, -5);

[if type=file term="/full system path to/images/thumb/[data session
  <a href="/items/[data session mv_perl_result]_2.gif">
   <img border="0" src="thumb/[data session mv_perl_result]_thumb2.gif"
width=60 height=60 alt="Click to view"></a>

[if type=file term="/full system path to/images/thumb/[data session
  <a href="/items/[data session mv_perl_result]_3.gif">
   <img border="0" src="thumb/[data session mv_perl_result]_thumb3.gif"
width=60 height=60 alt="Click to view"></a>

Here's how it works:

Images are named imagename_1.gif, imagename_2.gif etc.

Perl code takes image filename from [item-field image] and then removes the
last 5 characters and returns the image name
only which can then be used in flypage as above. The IF checks for the
presence of image_thumb2.gif, and if it's there,
loads the thumbnail with a link to larger image.   A simple Javascript
ImageSwap program can be used to allow thumbnails
clicks to replace the main image with corresponding image.


1. All images must have the same filename, with the file number appended
onto end as per 2.
2. Normal sized images should be named as _1.gif, _2.gif  etc, and thumbnail
images should be named as _thumb1.gif, thumb2.gif
2. First images should be uploaded normally via admin UI Add new item page,
other images can be uploaded using FTP or admin UI.
3. Since no further db queries for images are needed after the first image
query, this solution should have some performance benefits
     on busy sites.

Hope this is useful to someone!

Any comments/suggestions for improvement welcomed.

Find me on the web

No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.5.7 - Release Date: 01/03/05

More information about the interchange-users mailing list