imagerotate

From: Date: Wed, 05 Mar 2008 17:17:28 +0000
Subject: imagerotate
Groups: php.general 
Request: Send a blank email to php-general+get-271099@lists.php.net to get a copy of this message
Image Resize & Rotation Hi I have 2 scripts, one for Image rotation and other image resize and they both are working. Image resize scripts load the picture and resize it and Image rotation rotate the image by 90 deg. They are two differennt files i.e. resize.php and rotate.php. What I want to do is to combine both rotate.php & resize.php files, so when the script resized the image than it will call rotate script to rotate the image and display it on the screen.. I hope I am making sence.. I am finding hard to explain.. If u dont understand anything please let me know.. ************************* Code for rotate.php <?php // File and rotation $filename = 'image.png'; $degrees = 18; // Content type header('Content-type: image/png'); // Load $source = imagecreatefrompng($filename); // Rotate $rotate = imagerotate($source, $degrees, 0); // Output imagepng($rotate); ?> ============================ Code for resize.php <?php $src_img = imagecreatefrompng('image.png'); $srcsize = getimagesize('image.png'); $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]); header("content-type: image/png"); imagepng($dst_img); imagedestroy($src_img); imagedestroy($dst_img); ?> thanks

« previous php.general (#271099) next »