FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

image resize with GD

 


Antoine_935
Since ImageMagick is not available, I have to use GD, but I can't manage to resize a picture with it, it becomes black...
Code:
$image_p = imagecreatetruecolor(640, 480);
list($width, $heigth) = getimagesize($_FILES['picture']['tmp_name']);
$image = imagecreatefromjpeg($_FILES['picture']['tmp_name']);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, 640, 480, $width, $height);
imagejpeg($image_p, $uploadfile, 85);


WHY ?
hexkid
Antoine_935 wrote:
Since ImageMagick is not available, I have to use GD, but I can't manage to resize a picture with it, it becomes black...
Code:
$image_p = imagecreatetruecolor(640, 480);
list($width, $heigth) = getimagesize($_FILES['picture']['tmp_name']);
$image = imagecreatefromjpeg($_FILES['picture']['tmp_name']);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, 640, 480, $width, $height);
imagejpeg($image_p, $uploadfile, 85);


WHY ?


Because $heigth and $height are different variables!
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.