php image resize quality

Reply

Join Date: Jun 2005
Posts: 92
Reputation: michael123 is an unknown quantity at this point 
Solved Threads: 0
michael123 michael123 is offline Offline
Junior Poster in Training

php image resize quality

 
0
  #1
Oct 17th, 2005
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:
  1. $first=imagecreatefromjpeg($uploadfile);
  2. define(MAX_WIDTH, 180);
  3. define(MAX_HEIGHT, 135);
  4. $width = imagesx($first);
  5. $height = imagesy($first);
  6. $scale = min(MAX_WIDTH/$width, MAX_HEIGHT/$height);
  7. $new_width = floor($scale*$width);
  8. $new_height = floor($scale*$height);
  9. $second=imagecreate($new_width, $new_height);
  10. imagecopyresized($second,$first,0,0,0,0,$new_width,$new_height,$width,$height);
  11. imagejpeg($second,$v_thumbnailfile);

Thanks for any response.
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 92
Reputation: michael123 is an unknown quantity at this point 
Solved Threads: 0
michael123 michael123 is offline Offline
Junior Poster in Training

Re: php image resize quality

 
0
  #2
Oct 18th, 2005
Can anyone answer my question?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC