Archived posting to the Leica Users Group, 2002/11/05

[Author Prev] [Author Next] [Thread Prev] [Thread Next] [Author Index] [Topic Index] [Home] [Search]

Subject: Re: [Leica] Leica image presentation
From: "Tom Smart" <>
Date: Tue, 5 Nov 2002 12:41:51 -0600
References: <>

Actually, that would be a pretty easy (and fun) problem to solve.  Just set
a field or two in your database table that explains how you want that
picture to be displayed.  Then loop through an "If / Then" statement to
display it properly.  For instance:

If Not rsPhotos.EOF Then
    Do Until rsPhotos.EOF
        'This is where the customization come in
        Response.Write "<img border="
        response.write rsPhotos("BorderWidthField") & """
        response.write  "src=""" & rsPhotos("ImageSourceField") & """>"
End If

Just put an associated formatting field in for whatever you want to
customize for each image.  Then when you loop through the routine you can
make each image look however you want.  Make sense?

When I started a PAW page I added a field called "PAW" to my database table.
If an image is supposed to be displayed on the PAW page I put information
into that field such as "2002-43-Main" or "2002-43-Alt1".  Then when I loop
through my table grabbing all the paw images, I use this field to sort the
pictures according to week.  I also use it to display the alternate text
when you point your mouse at an image, so the text "Main" or "Alt1" appears.
All sorts of customized display information can be kept right with all the
rest of the image information in the database table.

Undoubtedly you have different (read "better")  ideas of how to display your
images, but that is the beauty of separating the data from the display.  And
if you change your mind you don't have to do a lot of recoding html.  Also,
if you decide to delete a picture you just need to be sure you run a routine
to check for the existence of that .jpg file before you try to display it.
A few lines of code like this:

If Not rsFiles.EOF Then
 Do Until rsFiles.EOF
  if fso.FileExists (server.mappath(rsFiles("Thumb"))) then
   response.write "<a href=""ShowPic.asp?Picture=" & rsFiles("Link") & """>"
   response.write "<img src=""" & rsFiles("Thumb") & """></a> "
  End If
 response.write "<p>No Results</p>"
End If

allows you to display only those images which still exist on your server,
skipping right by the ones that you got tired of.  No broken image links.
The basic model being something like:

1. Get the results from the database, including the formatting preference
for each image
2. Loop through the results, and as you handle each image do the following:
3. Check to see if the image file still exists on the server
4. Get the customized display information for the current image
5. Write the html to display it
6. Then move on to the next image until your database results are exhausted.

It takes an effort, but the possibilities become endless and the maintenance
becomes only a couple of pages instead of a page for each image.  That's
worth the effort in my opinion.  Keep up the great work.

- ----- Original Message -----
From: <>
To: <>
Sent: Tuesday, November 05, 2002 11:37 AM
Subject: Re: [Leica] Leica image presentation

> Tom,
> >>I think it is best to keep all image information in a database, then
> program
> a relatively few pages that grab information out of the database.  <<
> Thanks for the kind comments and the informative response. The database
> model is certainly efficient. My only concern is presentation. Some images
> just seem to do better with different borders and different backgrounds. I
> haven't figured out how to customize backgrounds and borders using a DB
> approach.
> DaveR
> --
> To unsubscribe, see

- --
To unsubscribe, see

In reply to: Message from (Re: [Leica] Leica image presentation)