I am stuck in a program that is causing me much trouble. I am trying to show an image as a thumbnail along with other text. I have some data fields and the information about the image saved in mysql database. Here I am able to retrrieve the data fields but not sure how exactly I could print the thumbnail along.
Can some one please please help?
Here is my code that I am printing
/ Display the results of the search
printf("<TABLE BORDER WIDTH=\"100%%\" BGCOLOR=\"#dcdcdc\" NOSAVE>\n");
printf("<TR>
<TD><B>Price</B></TD>
<TD><B>Year</B></TD>
<TD><B>Make</B></TD>
<TD><B>Model</B></TD>
<TD><B>Kilometers</B></TD>
<TD><B>Detail</B></TD>
<TD><B>Image</B></TD>
<TD><B>MODIFY/DELETE</B></TD>
</TR>\n");
while (($row = mysql_fetch_object($result))){
printf("<TR>
<TD>%s</TD>
<TD>%s</TD>
<TD>%s</TD>
<TD>%s</TD>
<TD>%s</TD>
<TD>%s</TD>
<TD>I want to insert an Image here</TD>
<TD><A HREF=\"modify.php?rowid=%s\"><I>Modify</I></A>/
<A HREF=\"delete.php?rowid=%s\"><I>Delete</I></A></TD>
</TR>\n",
$row->price, $row->year, $row->make, $row->model, $row->kilometers, $row->detail,
$row->rowid, $row->rowid) ;
}
printf("</TABLE>\n");
I have some code for printing image as well, but does not seem to work
function thumbnail($image_path,$thumb_path,$image_name,$thumb_width)
{
$src_img = imagecreatefromjpeg("$image_path/$image_name");
$origw=imagesx($src_img);
$origh=imagesy($src_img);
$new_w = $thumb_width;
$diff=$origw/$new_w;
$new_h=$new_w;
$dst_img = imagecreate($new_w,$new_h);
imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($src_img));
imagejpeg($dst_img, "$thumb_path/$image_name");
return true;
}
The information I am saving in my database about image:
Image_type
Image_size
Image_name
Image_location
Image_prefix
Image_extension
Please help!