Forum Moderators: phranque

Message Too Old, No Replies

Using images on site from a remote site and allowing for no images

         

wintercornuk

9:37 am on Aug 16, 2004 (gmt 0)

10+ Year Member



I have a book site and I want to include cover images. I have a supplier who uses images and I can include some code in my pages to get the right cover image for each title.

However, not all titles have images and when the code is included in the page I get the broken image thing.

The url is [theirdomain.com...]

I just replace ISBNNUMBER with each real ISBN on the page.

How can I show a "no image" icon when there isn't an image for that ISBN?

Is it possible?

My site is a hosted cart running on ASP.

Thanks for reading this far.

chicagohh

11:46 pm on Aug 16, 2004 (gmt 0)

10+ Year Member



You could do something like the following -

On each page that you wish to hot link (make sure you have the other sites permission) add the following code at the top of the page.


<%
On Error Resume next
url = "http://www.qraybracelets.com/images/deluxe-nat-ahead.jpg"
set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "GET", url, false
xmlhttp.send ""

myStatus = (xmlhttp.status)
set xmlhttp = Nothing
%>

Now, you have a value in the myStatus variable. It will be a 200 if the file is found in which case you would display the image (using a small amount of script). If it is not a 200 just display your no image icon.

wintercornuk

11:15 am on Aug 17, 2004 (gmt 0)

10+ Year Member



chicago,

thanks. i tried it and it didn't work.

wintercornuk

chicagohh

3:22 pm on Aug 17, 2004 (gmt 0)

10+ Year Member



It does work. I wrote it and tested it before I posted.

Sticky me what your doing - your code if you want.

Joe

wintercornuk

9:04 am on Aug 19, 2004 (gmt 0)

10+ Year Member



Sent!