Author Topic: creating a thumbnail  (Read 418 times)

0 Members and 1 Guest are viewing this topic.

Offline contra10Topic starter

  • Enthusiast
  • Posts: 402
    • View Profile
creating a thumbnail
« on: May 28, 2009, 10:50:48 AM »
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

Code: [Select]
<?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$im0000$desired_width$desired_height$x$y);

imagedestroy($im); 

echo 
"<div style='width: 100%; padding: 3px; border: 1px solid #000; background-color: green;'>" imagejpeg($newnull85)  . "</div>";
?>



Offline BK87

  • Enthusiast
  • Posts: 496
    • View Profile
Re: creating a thumbnail
« Reply #1 on: May 28, 2009, 10:55:32 AM »
the directory has to be something like "./toronto/image.jpg" not http://localhost ....
- Free image hosting =)

Offline contra10Topic starter

  • Enthusiast
  • Posts: 402
    • View Profile
Re: creating a thumbnail
« Reply #2 on: May 28, 2009, 11:05:54 AM »
i still get the symbols not the actual image


Code: [Select]
<?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$im0000$desired_width$desired_height$x$y);

imagedestroy($im); 

echo 
"<div style='width: 100%; padding: 3px; border: 1px solid #000; background-color: green;'>" imagejpeg($newnull85)  . "</div>";
?>