Click to See Complete Forum and Search --> : thumbs.db file in php gallery


LogicOpinion
04-20-2008, 01:06 PM
Hello, here is a lil code for creating a thumbnails on the page which opens bigger .jpg file when clicked on it.. everything works fine.. but lil error appears.

there are 4 images in 1 row.. so if i have nine images in folder it displays all of them as it should.. and there also appears an missing img icon like:

and url of this missing img is "uploads/thumbs.db


See this img (http://www.1school.ge/img_1.jpg)


and here is the code:


<BR>
<table align="center" border="0" cellpadding="0" cellspacing="0" width="530" height="50">
<TR><TD height="50"><img src="images/gallery_ge_pgtitle.jpg"></TD></TR>
</table>
<?php
function createThumbs( $pathToImages, $pathToThumbs, $thumbWidth )
{

$dir = opendir( $pathToImages );


while (false !== ($fname = readdir( $dir ))) {

$info = pathinfo($pathToImages . $fname);

if ( strtolower($info['extension']) == 'jpg' )
{



$img = imagecreatefromjpeg( "{$pathToImages}{$fname}" );
$width = imagesx( $img );
$height = imagesy( $img );


$new_width = $thumbWidth;
$new_height = floor( $height * ( $thumbWidth / $width ) );


$tmp_img = imagecreatetruecolor( $new_width, $new_height );


imagecopyresized( $tmp_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height );


imagejpeg( $tmp_img, "{$pathToThumbs}{$fname}" );
}
}

closedir( $dir );
}
createThumbs("images/upload/","images/upload/thumbs/",100);



function createGallery( $pathToImages, $pathToThumbs )
{

$output .= "<table cellspacing=\"15\" align=\"center\" cellpadding=\"4\" width=\"500\">";
$output .= "<tr>";


$dir = opendir( $pathToThumbs );

$counter = 0;

while (false !== ($fname = readdir($dir)))
{

if ($fname != '.' && $fname != '..')
{
$output .= "<td style=\"border-top:1px #CCCCCC solid; border-bottom:1px #CCCCCC solid; border-left:1px #CCCCCC solid; border-right:1px #CCCCCC solid;\" valign=\"middle\" align=\"center\"><a href=\"{$pathToImages}{$fname}\" target=\"_blank\">";
$output .= "<img src=\"{$pathToThumbs}{$fname}\" border=\"0\" />";
$output .= "</a></td>";

$counter += 1;
if ( $counter % 4 == 0 ) { $output .= "</tr><tr>"; }
}
}

closedir( $dir );

$output .= "</tr>";
$output .= "</table>";
print "$output";

}
createGallery("images/upload/","images/upload/thumbs/");
?>




can someone tell me why this happens?


THANKS IN ADVANCE

LogicOpinion
04-20-2008, 01:21 PM
Thanks, Problem Solved !!!!