Replcae Broken Images

Discussion in 'ASP General' started by Jake, Oct 17, 2005.

  1. Jake

    Jake Guest

    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.

    How can I achieve this?

    Thanks in Advance!
    Jake, Oct 17, 2005
    #1
    1. Advertising

  2. Jake

    Evertjan. Guest

    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)
    Evertjan., Oct 17, 2005
    #2
    1. Advertising

  3. Jake

    Bob Lehmann Guest

    Search for FileSystemObject and then read up on the Exists method.

    Bob Lehmann

    "Jake" <> wrote in message
    news:e3bQ4%...
    > 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.
    >
    > How can I achieve this?
    >
    > Thanks in Advance!
    >
    >
    Bob Lehmann, Oct 18, 2005
    #3
  4. Jake

    AlanM Guest

    try the fileexists method of FileSystemObject

    this is only good if you have the images on the same machineas your asp app.


    "Jake" <> wrote in message
    news:e3bQ4%...
    > 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.
    >
    > How can I achieve this?
    >
    > Thanks in Advance!
    >
    >
    AlanM, Oct 18, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jacob

    Broken Images ASP.NET/IIS Problem

    Jacob, Feb 28, 2004, in forum: ASP .Net
    Replies:
    7
    Views:
    583
    Jacob
    Feb 29, 2004
  2. Antoni Massó Mola

    .NET & IIS Broken Images

    Antoni Massó Mola, Apr 27, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    427
    George Ter-Saakov
    Apr 27, 2004
  3. Steven D'Aprano

    Why are "broken iterators" broken?

    Steven D'Aprano, Sep 21, 2008, in forum: Python
    Replies:
    8
    Views:
    634
  4. Cameron Simpson

    Re: Why are "broken iterators" broken?

    Cameron Simpson, Sep 22, 2008, in forum: Python
    Replies:
    0
    Views:
    569
    Cameron Simpson
    Sep 22, 2008
  5. Fredrik Lundh

    Re: Why are "broken iterators" broken?

    Fredrik Lundh, Sep 22, 2008, in forum: Python
    Replies:
    0
    Views:
    589
    Fredrik Lundh
    Sep 22, 2008
Loading...

Share This Page