Forum: Community Center


Subject: Image Resizing is really NOT a good idea

SeanE opened this issue on Jun 14, 2006 ยท 183 posts


3dvice posted Thu, 15 June 2006 at 12:56 PM

Just a proposal: Example for proper anti-aliased rescaling with PHP and the GD library 2.x ------------- code example ------------------------------ $source = ImageCreateFromJPEG('test.jpg'); $width = ImageSx($source); $height = ImageSy($source); $x = $width/1.5; $y = $height/1.5; $destination = ImageCreateTrueColor($x,$y); ImageCopyResampled($destination,$source,0,0,0,0,$x,$y,$width,$height); header('Content-Type: image/jpeg'); ImageJPEG($destination,'',100); -------------- end code example ------------------------- No ragged edges here! plus a benefit for slow dial-up connections (smaller filesize) No need for bad quality rescaling in the browser with the width attribute of the image tag in HTML or CSS!

Le cinéma substitue à notre regard un monde qui s'accorde à nos désirs. - André Bazin