Gossamer Forum
Home : Products : DBMan : Discussions :

Re: [carlstevenson] showing images based on the contents of a field

Quote Reply
Re: [carlstevenson] showing images based on the contents of a field In reply to
So you are just storing the photo name and not the url to the photo? If so, you could setup a variable in your .cfg file for the path to your image directory such as this:

$imgdir = '<A HREF="../images">';

using a relative path (from where you have you db files) to the name of YOUR image directory .

Then where you want to display your photos and assuming your field is called "Photo" you could use:

<IMG SRC= "$imgdir/$rec{'Photo'}" width="$rec{'P_W'}" height="$rec{'P_H'}" ALT="$rec{'Caption'}" BORDER=0 ALIGN=Middle>

Rename "Photo" to match the name of the field as defined for your database.

Notice in the above example I have also defined the height and width of the photos as "P_W" and "P_H" as separate fields (so the pages would load quickly). And also used another field for the ALT tag, which could be the field defined for the name of the image.

Hope this gives you some ideas. There are various thread related to working with images in the FAQ noted below under the section "Images".

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Subject Author Views Date
Thread showing images based on the contents of a field carlstevenson 3355 Nov 1, 2002, 5:21 AM
Thread Re: [carlstevenson] showing images based on the contents of a field
LoisC 3262 Nov 1, 2002, 9:37 AM
Post Re: [LoisC] showing images based on the contents of a field
carlstevenson 3266 Nov 1, 2002, 10:36 AM