prakash911 Posted March 17, 2010 Share Posted March 17, 2010 here is my code to generate and display thumbnail function createthumbnail($name,$filename,$width,$height) { $system = explode('.',$name); if (preg_match('/jpg|jpeg/',$system[1])) { $image = imagecreatefromjpeg($name); } if (preg_match('/png/',$system[1])) { $image = imagecreatefrompng($name); } $x = imageSX($image); $y = imageSY($image); if ($x > $y) { $thumb_w= $width; $thumb_h= $y*($height/$x); } if ($x < $y) { $thumb_w= $x*($width/$y); $thumb_h= $height; } if ($x == $y) { $thumb_w = $width; $thumb_h = $height; } $dst_img = ImageCreateTrueColor($thumb_w,$thumb_h); imagecopyresampled($dst_img,$image,0,0,0,0,$thumb_w,$thumb_h,$x,$y); if (preg_match("/png/",$system[1])) { imagepng($dst_img,$filename); } else { imagejpeg($dst_img,$filename); } imagedestroy($dst_img); imagedestroy($image); } while ($row = mysql_fetch_assoc($result)) { print "<tr>\n"; foreach ($row as $col_value) { print "<tb>"; createthumbnail('pics/beautifulWebDesign.jpg','pics/beautifulWebDesign.jpg',100,100); print "</tb>\n"; $col_value = htmlspecialchars(stripslashes($col_value)); print "<td>$col_value</td>\n"; } $isbn = $row['isbn']; ?> <form action="<?php echo $self?>" method="POST"> <td> <input type="hidden" name="isbn" value="<?php echo $isbn?>"> <input type="text" name="quantity" value="1" size="2"> <input type="submit" name="add" value="add"> </td> </form> <?php } ?> i want the image to be displayed in the pictures column down all the rows, but when i run it i get this. no image is being displayed and i am not even getting any error messages. Link to comment https://forums.phpfreaks.com/topic/195623-php-pros-help-me-with-thumbnail-display/ Share on other sites More sharing options...
prakash911 Posted March 18, 2010 Author Share Posted March 18, 2010 please i really need this to work, cant anyone spot the problem. Link to comment https://forums.phpfreaks.com/topic/195623-php-pros-help-me-with-thumbnail-display/#findComment-1027880 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.