note 33338 added to function.imagerotate

From: Date: Mon, 23 Jun 2003 14:37:25 +0000
Subject: note 33338 added to function.imagerotate
Groups: php.notes 
Request: Send a blank email to php-notes+get-50870@lists.php.net to get a copy of this message
The following code resizes the outputted image to fit the rotation. <?php Header("Content-type: image/jpeg"); $filename = "filename.jpg"; $img_size = getImageSize($filename); $x = $img_size[0]; $y = $img_size[1]; if ($x > $y) { $newd = $x; } else { $newd = $y; } $src_img = ImageCreateFromJPEG($filename); $dst_img = ImageCreateTrueColor($newd,$newd); $final_img = ImageCreateTrueColor($y,$x); ImageCopyResampled($dst_img,$src_img,0,0,0,0,$x,$y,$x,$y); $degrees = "90"; $rotated_img = ImageRotate($dst_img,$degrees,0); ImageCopyResampled($final_img,$rotated_img,0,0,0,0,$y,$x,$y,$x); ImageJPEG($final_img); ?> ---- Manual Page -- http://www.php.net/manual/en/function.imagerotate.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33338 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33338&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33338&report=yes

« previous php.notes (#50870) next »