FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free 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!
Related topics
Uploading and resizing an image
GD or ImageMagick Support?
Image resize function
I need georgia.ttf .... How can I do it ?
How to show RSS feeds in the forum Signature
web stats in a web banner, how do u make it appear in sig
Picture resizing software :?:
Any program that modifies picture resolution?
Textbox - line break problem
Easy handling for over-wide posts
PHP Tutorials
How would I resize an image from this code?
Create,Resize,Thumb, Shadow of your Images
Resize image in PNG Problem
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

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