Forums

ASP

This topic is locked

Trying to display a default image if non exists

Posted 06 Oct 2006 19:14:43
1
has voted
06 Oct 2006 19:14:43 bry keen posted:
Hello,

I am having an issue. This code displays the default image for every record instead of only displaying
when the proper image is not there. the images are stored in a directory outside of the db.
Any Help would be greatly appreciated. Lost.....

<!--image start -->
<%
Dim objFSO, imagePath, workingDir

Set objFSO = Server.CreateObject("Scripting.FileSystemObject"

workingDir = "www.premier.com/listingsphotos-all/"

imagePath = workingDir & New_Listing.Fields.Item("MLS#".Value

If objFSO.FileExists(server.Mappath("imagePath") Then
Response.Write "<img src="""&imagePath& ".jpg />"
Else
Response.Write "<img src=""www.premier.com/graphics/no_photo_small.gif"" />"
End If
%>
<!--stop img -->

Reply to this topic