Welcome to WebmasterWorld Guest from 54.221.49.52

Forum Moderators: ocean10000

Message Too Old, No Replies

Deal with Image not Found

Need classic ASP code

     

iloveu

2:41 am on Dec 14, 2005 (gmt 0)

10+ Year Member



I run a site with classic ASP. One situation is: when a visitor clicks a page with broken image link (no image file at all), the ASP code is able to detect it, and display a "Picture Not Found" or "Picture coming soon" image instead.

Like:

IF the picture not exists THEN
disply a image of "Picture coming soon"
ELSE
'just show the picture
EMD IF

Do you know how to write this code with classic ASP?

Krapulator

1:35 am on Dec 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A possible solution would be to create an ASP page which displays an image based on a url parameter.

EG something like:

view-image.asp?url=/images/whatever.jpg

then in the code on your view-image.asp page, you could use the filesystem object to test whether the image exists on the server and then show it if it exists and show an alternate if it doesn't.

duckhunter

3:58 pm on Dec 16, 2005 (gmt 0)

10+ Year Member



Use the XMLHttp object to open the image's URL. If object.status = 200, it's there.

(Kinda expensive operation to do everytime someone hits the page tho)

 

Featured Threads

Hot Threads This Week

Hot Threads This Month