p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Pro JSP (http://p2p.wrox.com/forumdisplay.php?f=93)
-   -   Alternate pictures / video (http://p2p.wrox.com/showthread.php?t=22421)

Mantis December 10th, 2004 08:23 PM

Alternate pictures / video
 
Hi,

I am absolutely useless at Java but I recon this is the language needed.

alright.. where to start without getting confusing...

I store HTML documents in MySQL.. all fine.
Some of those HTML documents contain code to insert pictures or video like this one:
<img border="0" dynsrc="test2.wmv" start="mouseover" loop="0" width="208" height="98"></p>
or
<img border="0" src="Pictures/test.jpg" width="100" height="144" align="left">

What I need is a code which will automatically change the picture or video name to a 'default' picture or video, incase the original is missing.

If this isn't possible, I can write (with time!) a small program in PHP which will look for the string .gif" and will replace it with .gif" alt="nopicture.gif" but I will really prefer a clean way for doing this.. if its possible.[?]

Thanks.

Mantis December 11th, 2004 08:44 PM

Just done some test and in my surprise.. there is no way to display an alternate picture in HTML if the original is missing...

Snib December 11th, 2004 10:13 PM

I believe your conclusion is incorrect.

Try this:

<img src='your_original_pic.jpg' onerror='this.src="your_replacement_pic.jpg"' alt='test'/>

-Snib - http://www.snibworks.com
Where will you be in 100 years?

Mantis December 12th, 2004 08:09 AM

I'm glad to be wrong :)

I'm using the notepad and MS frontpage.. just so you know, if you enter your line in MS Frontpage, the preview generate an error message..(works fine from the host server) so I would have been looking forever without your help!

Thks.


All times are GMT -4. The time now is 04:29 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.