alternative image ??

S

Sid

i want a jpg image displayed...but...if the jpg does not exist at the
specified URL, i want another jpg displayed (with a different URL) - i need
a default image displayed in the event of the original image not existing,
or being removed at the server.

I'm aware of IMG alt "alternate text" tag, but having an alternate image
instead of alternative text would do it. is there anyway to do this in a
simple way...and would it cause local cache problems with browers viewing
over the internet...is there a way to force a page rebuild (to eliminate
cache problems).
 
S

SpaceGirl

Sid said:
i want a jpg image displayed...but...if the jpg does not exist at the
specified URL, i want another jpg displayed (with a different URL) - i need
a default image displayed in the event of the original image not existing,
or being removed at the server.

I'm aware of IMG alt "alternate text" tag, but having an alternate image
instead of alternative text would do it. is there anyway to do this in a
simple way...and would it cause local cache problems with browers viewing
over the internet...is there a way to force a page rebuild (to eliminate
cache problems).

You need to think about this differently. How is the image specified?
You could very easily do what you want using serverside scripting. You
CANNOT do this within HTML.
 
L

Lauri Raittila

You need to think about this differently.
Perhaps.

You CANNOT do this within HTML.

He very easily can do it with HTML:

<OBJECT data="first.jpg" type="image/jpeg">
<OBJECT data="second.jpg" type="image/jpeg">
Alternative text
</OBJECT>
</OBJECT>

http://www.w3.org/TR/html4/struct/objects.html#h-13.3

http://www.w3.org/TR/html4/struct/objects.html#h-13.3.1
| If the user agent is not able to render the object for whatever
| reason[...], it must try to render its contents.

I have no idea if it works though... If someone tests it, please tell.
 
S

Spartanicus

Sid said:
i want a jpg image displayed...but...if the jpg does not exist at the
specified URL, i want another jpg displayed (with a different URL) - i need
a default image displayed in the event of the original image not existing,
or being removed at the server.

I'm aware of IMG alt "alternate text" tag, but having an alternate image
instead of alternative text would do it. is there anyway to do this in a
simple way...and would it cause local cache problems with browers viewing
over the internet...is there a way to force a page rebuild (to eliminate
cache problems).

<object type="image/jpeg" data="img.jpg" width="100" height="100">
<object type="image/jpeg" data="altimg.jpg" width="100" height="100">
Sensible text alternative
</object>
</object>

Don't expect it to work in IE though (scrollbars around the element).
 
N

Nik Coughin

Spartanicus said:
<object type="image/jpeg" data="img.jpg" width="100" height="100">
<object type="image/jpeg" data="altimg.jpg" width="100"
height="100"> Sensible text alternative
</object>
</object>

Don't expect it to work in IE though (scrollbars around the element).

Doesn't work in IE, FF or Opera.

If img.jpg doesn't exist FF gives me a broken image symbol and Opera shows
nothing. IE... IE is just broken. Shows both with scrollbars.
 
S

Spartanicus

Nik Coughin said:
Doesn't work in IE, FF or Opera.

Works for me with Moz 1.5, FF 0.9.2 and Opera 6. Opera 7 has an object
bug that regrettably hasn't been fixed in v8.
 
T

Travis Newbury

Spartanicus said:
Works for me with Moz 1.5, FF 0.9.2 and Opera 6. Opera 7 has an object
bug that regrettably hasn't been fixed in v8.

It seems to me that if it doesn't work in IE, that makes it unusable on
the web. Or you can just accept that 80%+ of your visitors will not
see it correctly.
 
L

Leif K-Brooks

Travis said:
It seems to me that if it doesn't work in IE, that makes it unusable on
the web.

MSIE is arguably not a Web browser, so it's perfectly usable on the Web.
 
T

Travis Newbury

Leif said:
MSIE is arguably not a Web browser, so it's perfectly usable on the
Web.

No argument there, but (sigh)the second half of my statement is still
true... (0_o)
 
N

Nik Coughin

Spartanicus said:
Works for me with Moz 1.5, FF 0.9.2 and Opera 6. Opera 7 has an object
bug that regrettably hasn't been fixed in v8.

Ah OK. Didn't try Moz, and I am running FF 1.02 and Opera 7.54, so there we
go.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top