Welcome to the Linux community forum and interact with 2 million technical staff to enter the php rotating picture 90 degrees. The method is not difficult. Let's take a look at the function below: the code is as follows: [php] viewplaincopy *** modify an image to flip it to a specified degree ** @ paramstring $ filename file name (including file path) * @ paramf
Welcome to the Linux community forum and interact with 2 million technicians> go to php to rotate the image 90 degrees. The method is not difficult. Let's take a look at the function below: the code is as follows: [php] view plaincopy/*** modify an image to flip it to a specified degree ** @ param string $ filename file name (including file path) * @ param f
Welcome to the Linux community forum and interact with 2 million technicians>
Php rotating images 90 degrees, the method is not difficult. Let's take a look at the function below:
The Code is as follows:
[Php] view plaincopy
/**
* Modify an image to flip it to a specified degree
*
* @ Param string $ filename file name (including file path)
* @ Param float $ degrees rotation degree
* @ Return boolean
*/
Function flip ($ filename, $ src, $ degrees = 90)
{
// Read the image
$ Data = @ getimagesize ($ filename );
If ($ data = false) return false;
// Read the old image
Switch ($ data [2]) {
Case 1:
$ Src_f = imagecreatefromgif ($ filename); break;
Case 2:
$ Src_f = imagecreatefromjpeg ($ filename); break;
Case 3:
$ Src_f = imagecreatefrompng ($ filename); break;
}
If ($ src_f = "") return false;
$ Rotate = @ imagerotate ($ src_f, $ degrees, 0 );
If (! Imagejpeg ($ rotate, $ src, 100) return false;
@ Imagedestroy ($ rotate );
Return true;
}
The above is how php rotates images 90 degrees. I hope this article will be helpful to php developers. Thank you for reading this article.