i made a folder images in d:/wamp/www/images and uploaded photos to it and sent the path to of the images to the database e.g
image_path = d:/wamp/www/images/apples.jpg
now i want to create a gallery showing thumbnails of the images i created the script below ....its supposed to read the image path and resize the image and then display it but tis not doing so ....
its giving me output as
"; echo $thumbnail; echo " image thumbnail "; ?>
here's my code
<?
// generating a array with image paths
$query_images = "SELECT image_path FROM userfolders" ;
$result_images = mysql_query($query_images);
confirm_query($result_images);
while ($record_images = mysql_fetch_assoc($result_images)) {
$image_list[] = $record_images['image_path'] ;
?>
<?
// generating a thumbnail
$thumb_height = 100;
while ($record_images = mysql_fetch_assoc($result_images))
{
$filename = $image_list[];
list($width, $height) = getimagesize($filename);
$ratio = ($height/$width);
$newheight = $thumb_height;
$newwidth = ($thumb_height/$ratio);
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($filename);
$thumb_image = imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
// displaying thumbnail
$thumbnail = "<img src= ".$thumb_image.">";
echo $thumbnail;
echo " image thumbnail ";
?>
please tell me where i m going wrong