Hi, i am using a thumbnail script to display smaller versions of photos on a website.
The paths to the high res pictures are stored in a DB, and i have been looping through the DB to take the path, and run it through a thumbnail generator script, which outputs a jpg file.
This works fine for a batch of photos less than 10, anymore than this and some of the pictures display as broken links, yet when i click "show picture" it displays it.
Which would suggest that the php script is simply skipping some pictures, due to the sheer amount. But this happens after 10, and the high res versions are only 400 pixels by 300, jpeg photos?!!
Ive tried using set_time_limit() but this doesnt help! Any one got any other ideas?
The code im using is ....
The loop which displays the pics ....
<?php
$sql = "SELECT picture_path FROM loc_pictures WHERE gallery_id = '$_GET[gallery]'";
$result = mysql_query($sql);
echo "<p><u><i>";
echo $num = mysql_num_rows($result) . " pictures found";
echo "</u></i></p>";
echo "<p align = 'center'>";
while ($row = mysql_fetch_array($result))
{
echo "<a href = '$row[picture_path]' rel = 'lightbox'>";
echo "<img src='thumb.php?filename=$row[picture_path]' border = '0' /></a>";
echo " ";
}
echo "</p>";
?>
and the thumbnail script is ....
<?php
// File and new size
$percent = 0.25;
// Content type
header('Content-type: image/jpeg');
// Get new sizes
list($width, $height) = getimagesize($filename);
$newwidth = $width * $percent;
$newheight = $height * $percent;
// Load
$thumb = imagecreatetruecolor(100, 75);
$source = imagecreatefromjpeg($filename);
// Resize
imagecopyresized($thumb, $source, 0, 0, 0, 0, 100, 75, $width, $height);
// Output
imagejpeg($thumb);
?>