Hello,
I have a problem when im trying to scale an jpeg image with libgd

my function lookes like this:

function image_resize_jpeg( $img, $w)
{
  $image = imagecreatefromjpeg($img);

  $img_info = getimagesize ($img);
  $orig_height = $img_info[1]; //source hieght from $img_info
  $orig_width = $img_info[0]; //source width from $img_info

if ($orig_width > $w) {
$h = ($w * $orig_height) / $orig_width;
$thumb = imagecreate($w, $h);
imagecopyresized($thumb, $image, 0, 0, 0, 0, $w, $h, $orig_width, $orig_height);
imagejpeg($thumb, $img, 95);
}
}


To illustrate:
Original image: http://www.thcca.com/~offson/test.jpg
scaled image: http://www.thcca.com/~offson/test_thumb.jpg

Does anyone have any suggestion what i can do?

_________________________________________________________________
Lättare att hitta drömresan med MSN Resor http://www.msn.se/resor/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to