Guest User

Untitled

a guest
Jul 16th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. function rotate_image($stupen,$file){
  2. $size = getimagesize($file);
  3. if($size[2] == IMAGETYPE_PNG){
  4. $im = imagecreatefrompng($file);
  5. $white = imagecolorallocate($im, 255, 255, 255);
  6.  
  7. $im = imagerotate($im, $stupen, $white);
  8. imagepng($im, $file, 100);
  9. }
  10. if($size[2] == IMAGETYPE_JPEG){
  11. $im = imagecreatefromjpeg($file);
  12. $white = imagecolorallocate($im, 255, 255, 255);
  13.  
  14. $im = imagerotate($im, $stupen, $white);
  15. imagejpeg($im, $file, 100);
  16.  
  17. }
  18. }
Add Comment
Please, Sign In to add comment