How can I rotate an image?



How can I rotate an image? ..

Answer / jude jeevanraj.p

Probably not something you will want to do a lot of in
ordinary day PHP use, but if you want to rotate an image
use the well-named imagerotate function.

This takes the image to rotate, the angle of rotation, and
a color to fill the blank space around the rotated image
with.

Here's an example:
<?php
$original = imagecreatefrompng("myimage.png");
$red = imageColorAllocate($original,255,0,0);
imagerotate($original,50,$red);
header("content-type:image/png");
imagepng($rotated);
imagedestroy($original);
imagedestroy($rotated);
?>

Is This Answer Correct ?    5 Yes 0 No

Post New Answer

More PHP Interview Questions

Is runtime polymorphism overriding?

0 Answers  


Why do we use query?

0 Answers  


What's the difference between using mysql_ functions and pdo?

0 Answers  


What is include in php?

0 Answers  


How to get the directory name out of a file path name?

0 Answers  






Is php still used?

0 Answers  


What beforeFilter() is used?

0 Answers   HCL,


Is apache needed for php?

0 Answers  


What is php beginner?

0 Answers  


Do you know what does mvc stand for and what does each component do?

0 Answers  


What are the advantages of not using any frameworks ?

1 Answers   Sonata,


How can we know the total number of elements of Array?

0 Answers  


Categories