Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Pro JSP
|
Pro JSP Advanced JSP coding questions. Beginning questions will be redirected to the Beginning JSP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro JSP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 10th, 2004, 08:23 PM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 154
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.
 
Old December 11th, 2004, 08:44 PM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 154
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Just done some test and in my surprise.. there is no way to display an alternate picture in HTML if the original is missing...
 
Old December 11th, 2004, 10:13 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

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?
 
Old December 12th, 2004, 08:09 AM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 154
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.





Similar Threads
Thread Thread Starter Forum Replies Last Post
chapter 10 - Alternate order walabok BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 March 19th, 2008 12:04 PM
play online video or video rajanikrishna ASP.NET 2.0 Basics 1 September 17th, 2007 01:01 PM
Video buffering, streaming, and displaying video t CurvyBabe C# 1 March 9th, 2007 01:17 PM
alternate method of using MapQuest tennisdad1 Javascript How-To 2 January 23rd, 2006 08:06 PM
alternate ordering polecat XSLT 17 October 2nd, 2003 08:35 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.