Re: Replcae Broken Images by Evertjan
Evertjan
Mon Oct 17 16:30:02 CDT 2005
Jake wrote on 17 okt 2005 in microsoft.public.inetserver.asp.general:
> Not sure if this can be done with ASP but I would like to find a way
> to detect if an image is missing and replace it with a default image
> instead of the dreaded RED X showing up.
Yes, it can be done with ASP,
if you set and use a dedicated 404.asp page.
Start that 404.asp page with something like:
[vbscript]
<%
qstr = lcase(Request.ServerVariables("QUERY_STRING"))
if right(qstr,4)=".jpg" or right(qstr,4)=".gif" then
response.redirect "/images/imageNotFound.gif"
end if
%>
=============
any html on your site, containing:
<img src='/somewhereElseOr/imageNotHere.jpg'>
will display the imageNotFound.gif picture,
which I have bitwize filled with the Dutch equivalent of:
"Sorry, this image is not available just yet".
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)