display image thumbnail by reading path from table and retrieving the image from folder
<p>I would be grateful if anybody could help me out with this. </p>

<p>I have a table which stores the filepath of a set of images, e.g col filepath stores values like: ./phpimages/image3.jpg. Note that my images are stored in folder 'phpimages'</p>

<p>Now i want to loop through all the rows in my table and display thumbnails of the images.</p>

<p>Here is my code:</p>

<p>/</p>

<pre><code>*************************Display all records from images table***************/
//create an instance is Image
$objImage = new Image;

$result = $objImage -&gt; listImage();
$num_rows = mysql_num_rows($result);
//echo $num_rows."records in database";


while($row = mysql_fetch_assoc($result)){

$imagepath="'".$row["filepath"]."'"; // note that if i put $imagepath= "dog.jpg", it displays the image just once!


//set mime type content
header('Content-Type: image/jpeg');


//create original image
$image = imagecreatefromjpeg($imagepath);

//get image dimension
$dim=getimagesize($imagepath);


//Set thumb dimension
$thumbw = 100;
$thumbh = 130;

//create empty image
$thumb_image=imagecreatetruecolor($thumbw, $thumbh);

//Resize original image and copy it to thumb image
imagecopyresampled($thumb_image, $image, 0, 0, 0, 0,
                    $thumbw, $thumbh, $dim[0], $dim[1]);


//display thumb image
imagejpeg($thumb_image);
}

?&gt;
</code></pre>

<p>Please can anyone tell me where my error lies? Many thanks for any help provided</p>
