Using "Thumbnails" to index downloadable images
===============================================
I am envisaging a situation where your site contains a number of large
image files, and SOME of the visitors would like to look at or download
SOME of those images; but it would be antisocial to force ALL visitors
to have to fetch/download ALL of those large image files.
If the HTML has a standard image tag
, then that
image will always be fetched and rendered, unless the visitor has
turned off graphics.
If that is replaced by a hyperlink
Artistic masterpiece,
the image will not be fetched/downloaded unless/until the visitor clicks
on the link. If/when they do, the image file will be fetched, and then
depending on their options configuration, their browser will either:
(a) present a "Save as" dialog box (or equivalent if non-Acorn); or
(b) fire up ChangeFSI and display the image in a separate window.
If you have several such image files, it can look nicer if each link
is shown as a "thumbnail" miniature of the full-resolution version;
of a size somewhere between that of a standard file icon (34 pixels
square) and a postage stamp (approx 70 x 85 pix).
Now it is possible to use the WIDTH and HEIGHT attributes of the IMG
tag to scale an image down to a smaller size; but this is a ridiculous
way of doing it, because it requires the full-sized file to be (slowly)
fetched, just to display a titchy image which could have been held in
a considerably smaller file!
So the practical solution is to create a second (and much smaller) image
file on the site, which holds the thumbnail, and is used in the IMG tag
inside the element, as in the example:
Since the thumbnail is a different file to the main image, it must have
a different name (or since recently, it could have the same name but be
in a different directory).
The choice of JPEG or GIF will be determined by the nature of the image
itself:
For the main large image, JPEG is usually best for scanned photographs,
or (conversion of) some ArtWorks files with a lot of colour graduations
(even better quality may be achieved by using TIFF: you can never rely
on a browser being able to render them, but they're OK for downloads),
but GIF is often better for screenshots of a drawfile or a line drawing;
For the thumbnail image, much the same could apply, but since the idea
is to minimise the filesize rather than maximise the quality, I usually
find that GIF is more suitable.
The final choice of filetype for each version of the image may influence
your choice of filenames: in RiscOS it is not possible to have (in the
same directory) two files of different filetypes but identical filename;
but you can have two names which differ only in their "slash-extension".
So some possible RiscOS ADFS name choices for image file pairs might be:
Fullsized: piccy/jpeg large/jpeg photos.pict3/gif
Thumbnail: piccy/gif small/jpeg thumbs.pict3/gif
etc.
John Alldred, 29June97
http://www.argonet.co.uk/users/protovale/john.html