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>"; ?> Quote Link to comment 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 .... Quote Link to comment 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>"; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.