Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To 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 19th, 2004, 09:30 AM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 154
Thanks: 0
Thanked 0 Times in 0 Posts
Default <Solved>load default pic when original is missing

A small contribution to this forum and thks for the people who helped me :)

Just finished this code. Put your HTML document(s) in the variable $Dataentry , then the code check for .jpg and automaticaly had :
onerror='this.src="Pictures/default.jpg"'/ (Thks for you help Snib!)
So if the original picture is missing a default picture is loaded instead.

<?php
$changetext='.jpg\"';
$jpgtext='.jpg\" onerror=\'this.src=\"Pictures/default.jpg\"\'/';
$Dataentry=str_replace($changetext,$jpgtext,$Datae ntry);
$Dataentry = stripslashes($Dataentry);
echo $Dataentry;
?>





Similar Threads
Thread Thread Starter Forum Replies Last Post
<style> tags in a <body> vs. <div> bcat BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 1 March 27th, 2005 08:50 AM
<marquee><b>About CHAT App. in PHP4</b></marquee> Ramkrishna PHP How-To 1 September 11th, 2004 07:01 AM
<CustomAssemblies> Missing (Chapter 5 p 154) jmurdock BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 June 16th, 2004 02:44 PM
Can Macintosh load <div>? danielh Javascript How-To 1 May 13th, 2004 10:27 AM
Ch 13 p 484 missing <ResourceParams> opening tag JHvdSloot JSP Basics 0 October 2nd, 2003 07:35 AM





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