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

How to concatenate two strings in php?

1 Answers  


What is json php?

1 Answers  


where do we use htaccess?

1 Answers  


What is the php function that removes the last element of the array and returns it?

1 Answers  


Does php need html?

1 Answers  


What is the purpose of $_ session?

1 Answers  


What is The difference between ' and " where they can ben in between or outmost and how

2 Answers   Avis Software,


What is the use of Php variables?

1 Answers  


How can we submit form without a submit button?

1 Answers  


Tell me what is the use of "ksort" in php?

1 Answers  


how to select the multiple data in selection button

1 Answers   xasis technologies,


When do sessions end?

1 Answers  


Categories