On Wed, Mar 5, 2008 at 12:17 PM, Zeshan Uddin <uzeshan@xxxxxxxxxxxxxx> 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); } ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php