How do you link to Disk Previews from thumbnails?

<< What commands does PortWe ...
Back to Portfolio FAQ index
How do you display Disk P ... >>

You may well wish to call a bigger image to screen than the thumbnail PortWeb can extract from a Catalogue, the latter only being 112x112 or 256x256 pixels. One easy candidate is to use the Disk Preview files that Portfolio can create for you. However, the snag is that the Previews have filenames like p0000000065.jpg that give no immediate cue as to the associated original image and you must script this association yourself.

To solve this problem I have created a JavaScript that when called will pop a new window displaying the appropriate disk preview. To allow you to try out the script I have created a template and test files which may be downloaded. They enable you to run and test a script which returns the path to a preview when supplied with the record's RID. The 'readme' file also has a fully commented version of the script below to aid those less familiar with JavaScript.

The script has the following compatibility requirements:

Remember, the syntax of a Portfolio-created Disk Preview is - p + padding zeroes + RID + .jpg - in which the zeroes + RID = 10 characters. Thus RID 1234 will give preview p00001234.jpg

Here is the script without any explanatory comment:
<script language="JavaScript" type="text/javascript">
// script created by Mark Anderson (

var persistPathToPrev = 'subfolder/'

function getPreview(myRID)
myRID = myRID.toString(10);
var winName = 'RID';
var myZeros = '0000000000';
var lengthRID = myRID.length;
myZeros = myZeros.slice(lengthRID);
myRID = 'p' + myZeros + myRID + '.jpg';
prevPath = persistPathToPrev + myRID;
myRID = '';
var popWindow;
popWindow =,winName,'toolbar=0,location=0,directories=0,status=0,menubar=0');

Sample usage in a PortWeb template:

<a href="javascript:getPreview(%RID%)">
<img src="%thumbnail%" border=0>

Don't forget there is a commented version and test files you can download.

Question: How do you link to Disk Previews from thumbnails? [FAQ00200.htm]
Last Update:- 31 May 2006

<< What commands does PortWe ...
Back to Portfolio FAQ index
How do you display Disk P ... >>

Quick Search of PortfolioFAQ (word, words or phase): or try the Advanced Search

User-to-User Forums  |  Report error/typo/broken link  |  Request new topic  |  Ask a question

Site and articles © Mark Anderson 2001-2007 - Visit my home page

This FAQ is created and maintained using
Friday logo
Friday - The Automatic FAQ Maker