Click to See Complete Forum and Search --> : Image not found


Josephsch
05-25-2005, 09:08 AM
can anyone help me write a if command like this:


if u cant find an image called $filename($pic = nopic.jpg)
else ($pic = $filename)

jacen6678
05-25-2005, 10:20 AM
I am confused by your question. I assume what you meant was:

if( u cant find an image called $filename)
{
$pic = nopic.jpg;
}
else
{
$pic = $filename;
}


and i think you want:

if( file_exists( $filename ) )
$pic = $filename;
else
$pic = 'nopic.jpg';

http://us4.php.net/manual/en/function.file-exists.php

Josephsch
05-25-2005, 10:39 AM
Thanks yes !
if( file_exists("pitem/$lower.jpg" ) )
$lower = $lower;

else $lower = Nopic;
works lovely