Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Images

Viewing Image from directory HELP

images php coding issues or problems here.

Moderators: macek, egami, gesf

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-

<?php
$dirname = "directory-name/";

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

};
}
?>


Please help me in displaying CUSTOM ERROR MSG IF NO images found in dat directory.
kumel619
New php-forum User
New php-forum User
 
Posts: 2
Joined: Mon Jul 25, 2011 12:13 am

Return to PHP coding => Images

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.