954,576 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

PHP image resize issue.

I try to resize jpeg from photo size to thumbnails, however the thumbnails quality is bad, it looks fade and blur, I have no idea how to improve the quality of thumbnails.
PHP resize function:
-----
$first=imagecreatefromjpeg($uploadfile)
$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
Junior Poster in Training
94 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 

Check out http://cr.php.net/imagejpeg

Using imagejpeg the third parameter is the quality... use 75 or more to not loose all the quality...

You can also create a default value for your script... like $def_quality=82;

Then you'll do:
[php]
imagejpeg($second,$v_thumbnailfile,$def_quality);
[/php]

hope this helps.

RamiroS
Junior Poster in Training
57 posts since Mar 2005
Reputation Points: 10
Solved Threads: 2
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You