Re: imagerotate

From: Date: Thu, 06 Mar 2008 21:19:48 +0000
Subject: Re: imagerotate
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-271100@lists.php.net to get a copy of this message
On Wed, Mar 5, 2008 at 12:17 PM, Zeshan Uddin <uzeshan@googlemail.com> wrote: > I have 2 scripts, one for Image rotation and other image resize and they > both are working. [snip!] > > What I want to do is to combine both rotate.php & resize.php files [snip!] The merged code is below, and you can see it on the web here, too: [Demo] http://pilotpig.net/code-library/displayresizeandrotate.php [Source] http://pilotpig.net/code-library/source.php?f=resizeandrotate.php [Source2] http://pilotpig.net/code-library/source.php?f=displayresizeandrotate.php New file: resizeandrotate.php <? $img = 'image.png'; $degrees = 18; $src_img = imagecreatefrompng($img); $srcsize = getimagesize($img); $dest_x = 200; $dest_y = (200 / $srcsize[0]) * $srcsize[1]; $dst_img = imagecreatetruecolor($dest_x, $dest_y); imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dest_x, $dest_y, $srcsize[0], $srcsize[1]); // Content type header('Content-type: image/png'); // Rotate $rotate = imagerotate($dst_img, $degrees, 0); // Output imagepng($rotate); imagedestroy($src_img); imagedestroy($dst_img); ?> -- </Dan> Daniel P. Brown Senior Unix Geek <? while(1) { $me = $mind--; sleep(86400); } ?>

« previous php.general (#271100) next »