Re: detect a file if it exist and display an image

From: Date: Fri, 17 Sep 2004 12:54:50 +0000
Subject: Re: detect a file if it exist and display an image
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-196944@lists.php.net to get a copy of this message
From: "Louie Miranda" <lmiranda@gmail.com>
im not sure if i coded one of my application wrong, i am displaying an image by displaying the itemcode and just adding a ".jpg" extension at the end. like this.. $itemCode = $row['itemCode']; .. <img src=/images/$itemCode.jpg> i assumed before that i can show it all, but i found out that i cannot. my problem now is the $itemCode is on a database and the image filename is on directory. Will it be possible to detect a image file it exist or not?
I'm not really following what you're asking for... If you're asking if you can just detect if an image file exists... if(file_exists("images/{$itemCode}.jpg")) { echo "<img src=\"images/{$itemCode}.jpg\">"; } else { echo "No image"; } ---John Holmes...

« previous php.general (#196944) next »