DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   PHP (http://www.daniweb.com/forums/forum17.html)
-   -   php image resize quality (http://www.daniweb.com/forums/thread34046.html)

michael123 Oct 17th, 2005 9:15 pm
php image resize quality
 
I try to use PHP GD library to resize image to thumbnail size, however I found the small converted image has bad quality(distorted color), how can I improve the image quality by using PHP GD library:
$first=imagecreatefromjpeg($uploadfile); 
define(MAX_WIDTH, 180);
define(MAX_HEIGHT, 135);
$width = imagesx($first);
$height = imagesy($first);
$scale = min(MAX_WIDTH/$width, MAX_HEIGHT/$height);
$new_width = floor($scale*$width);
$new_height = floor($scale*$height);
$second=imagecreate($new_width, $new_height);
imagecopyresized($second,$first,0,0,0,0,$new_width,$new_height,$width,$height);
 imagejpeg($second,$v_thumbnailfile);

Thanks for any response.

michael123 Oct 18th, 2005 3:22 pm
Re: php image resize quality
 
Can anyone answer my question?


All times are GMT -4. The time now is 11:13 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC