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 issue. (http://www.daniweb.com/forums/thread34727.html)

michael123 Oct 31st, 2005 2:50 pm
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.

RamiroS Oct 31st, 2005 3:59 pm
Re: PHP image resize issue.
 
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.


All times are GMT -4. The time now is 10:23 am.

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