contra10 Posted May 28, 2009 Share Posted May 28, 2009 im trying to create a thumbnal version of images that are in my directory but i can't seem to get it to work heres my coding <?php $im = imagecreatefromjpeg("http://localhost/toronto/image.jpg"); $x = imagesx($im); $y = imagesy($im); $desired_width = 60; $desired_height = $y * ($desired_width/$x); $new = imagecreatetruecolor($desired_width, $desired_height); imagecopyresampled($new, $im, 0, 0, 0, 0, $desired_width, $desired_height, $x, $y); imagedestroy($im); echo "<div style='width: 100%; padding: 3px; border: 1px solid #000; background-color: green;'>" . imagejpeg($new, null, 85) . "</div>"; ?> Link to comment https://forums.phpfreaks.com/topic/160029-creating-a-thumbnail/ Share on other sites More sharing options...
BK87 Posted May 28, 2009 Share Posted May 28, 2009 the directory has to be something like "./toronto/image.jpg" not http://localhost .... Link to comment https://forums.phpfreaks.com/topic/160029-creating-a-thumbnail/#findComment-844200 Share on other sites More sharing options...
contra10 Posted May 28, 2009 Author Share Posted May 28, 2009 i still get the symbols not the actual image <?php $im = imagecreatefromjpeg("image.jpg"); $x = imagesx($im); $y = imagesy($im); $desired_width = 60; $desired_height = $y * ($desired_width/$x); $new = imagecreatetruecolor($desired_width, $desired_height); imagecopyresampled($new, $im, 0, 0, 0, 0, $desired_width, $desired_height, $x, $y); imagedestroy($im); echo "<div style='width: 100%; padding: 3px; border: 1px solid #000; background-color: green;'>" . imagejpeg($new, null, 85) . "</div>"; ?> Link to comment https://forums.phpfreaks.com/topic/160029-creating-a-thumbnail/#findComment-844217 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.