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
I need georgia.ttf .... How can I do it ?
PHP Tutorials
GD or ImageMagick Support?
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 :?:
How would I resize an image from this code?
Uploading and resizing an image
Create,Resize,Thumb, Shadow of your Images
Any program that modifies picture resolution?
Image resize function
Resize image in PNG Problem
Textbox - line break problem
Easy handling for over-wide posts
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.