displaying an image on error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mxrideruk
Forum Newbie
Posts: 2
Joined: Mon Jan 08, 2007 7:37 am

displaying an image on error

Post by mxrideruk »

i am currently showing my images by this method
<img src="../images/release_images/<?php echo $row_full_release['image_2']; ?>" width="245" height="184" />

and if the image is missing it shows the missing image symbol but i want it to show a default image
can some one help me out
cheers
kev
User avatar
bokehman
Forum Regular
Posts: 509
Joined: Wed May 11, 2005 2:33 am
Location: Alicante (Spain)

Post by bokehman »

Code: Select all

<img src="../images/release_images/<?php 
    echo(
        @getimagesize('../images/release_images/'.@$row_full_release['image_2'])?
        $row_full_release['image_2']:
        'default.jpg'
    ) 
?>" width="245" height="184" />
Post Reply