Viewing Image from directory HELP

images php coding issues or problems here.

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 2
Joined: Mon Jul 25, 2011 12:13 am

Viewing Image from directory HELP

Postby kumel619 » Mon Jul 25, 2011 12:14 am

I have a page whr pictures r been displayed from the directory..
So when imgs r dr in directory it gets displayed in a page thru php code... Problem is whn dr s no image in dat directory den i get long error.. it irritates..

Codes are below-

$dirname = "directory-name/";

$images = scandir($dirname);
$ignore = Array(".", "..");
foreach($images as $curimg){
if(!in_array($curimg, $ignore)) {
echo "<img src='directory-name/$curimg' /><br/>


Please help me in displaying CUSTOM ERROR MSG IF NO images found in dat directory.

Return to “PHP coding => Images”

Who is online

Users browsing this forum: No registered users and 1 guest