uzeshan Posted March 4, 2008 Share Posted March 4, 2008 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 to "Thumbnail" 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, so when the scripts resize the image than it call rotate script to rotate the image 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.. thanks Zee Quote Link to comment Share on other sites More sharing options...
craygo Posted March 4, 2008 Share Posted March 4, 2008 why don't you just use imagerotate() in your image resize script. Just add it to the end after you have created the thumbnail. This however will not effect the original image which when clicked on will still be the original way. Ray Quote Link to comment Share on other sites More sharing options...
uzeshan Posted March 4, 2008 Author Share Posted March 4, 2008 thanks i ll try that... Quote Link to comment Share on other sites More sharing options...
uzeshan Posted March 4, 2008 Author Share Posted March 4, 2008 I am afraid no luck... I can see the thumbnail but not the rotation... Quote Link to comment Share on other sites More sharing options...
craygo Posted March 4, 2008 Share Posted March 4, 2008 Can you post the code that creates the thumbnail?? ray Quote Link to comment Share on other sites More sharing options...
uzeshan Posted March 5, 2008 Author Share Posted March 5, 2008 here is the 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); ?> ******************************************** Here is the code for rotate.php ==> *********************************************** <?php // File and rotation $filename = 'test.jpg'; $degrees = 180; // Content type header('Content-type: image/jpeg'); // Load $source = imagecreatefromjpeg($filename); // Rotate $rotate = imagerotate($source, $degrees, 0); // Output imagejpeg($rotate); ?> ********************************** thanks Quote Link to comment Share on other sites More sharing options...
uzeshan Posted March 5, 2008 Author Share Posted March 5, 2008 here is the right 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); ?> ****************** thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.