Php rotate an image 90 degrees, which is not difficult. Next, let's take a look at the function: *** modify an image so that it can be flipped to a specified degree ** @ paramstring $ filename file name (including the file path) * @ paramfloat $ degrees rotation degree * @ re php: rotate the image 90 degrees. the method is not difficult. let's take a look at the function below:
/*** Modify an image to flip it to a specified degree ** @ param string $ filename file name (including the file path) * @ param float $ degrees rotation degree * @ return boolean */function flip ($ filename, $ src, $ degrees = 90) {// php development training course http://www.tsingyuan.cn // read Picture $ 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;} (PS: ^ _ ^ good php Development Group: 276167802, verification: csl, thank you !) If ($ src_f = "") return false; $ rotate = @ imagerotate ($ src_f, $ degrees, 0); if (! Imagejpeg ($ rotate, $ src, 100) return false; @ imagedestroy ($ rotate); return true ;}
The code is as follows: