homepage Welcome to WebmasterWorld Guest from 54.204.58.87
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
resize images w/o sacrificing quality
basic php image resize can really make your images look bad...
irock




msg:1303372
 8:05 pm on Nov 5, 2002 (gmt 0)

I'm trying to add a JPEG image resize for my catalog. However, when I tried to use the following code. My images would look very wash out. I was wondering if there's a way to resample the size of the image w/o scarificing the quality of the original image. I'm using PHP/mySQL.

<?php
$orig_image = imagecreatefromjpeg("path/to/imagefile.jpg");
$sm_image = Imagecreate(50,50);
Imagecopyresized($sm_image,$orig_image,0,0,0,0,50,50,imagesx($orig_image),imagesy($orig_image));
Header("Content-type: image/jpeg");
imageJPEG($sm_image);
imagedestroy($sm_image);
imageDestroy($orig_image);
?>

 

andreasfriedrich




msg:1303373
 8:24 pm on Nov 5, 2002 (gmt 0)

Use imagecopyresampled [php.net] instead of imagecopyresized.

irock




msg:1303374
 9:09 pm on Nov 5, 2002 (gmt 0)

Do you konw how to get GD 2.0 support?

Mine is only GD 1.62.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved