How to rotate image and save the image

前端 未结 5 1975
予麋鹿
予麋鹿 2020-12-03 02:03

In my application i have an image in a div,a button.

I want to rotate the image displayed and save the rotated image when i clicked on the button using jquery.

5条回答
  •  一整个雨季
    2020-12-03 02:36

    //define image path
    $filename="image.jpg";
    
    // Load the image
    $source = imagecreatefromjpeg($filename);
    
    // Rotate
    $rotate = imagerotate($source, $degrees, 0);
    
    //and save it on your server...
    imagejpeg($rotate, "myNEWimage.jpg");
    

    Take a look at:

    imagerotate()

    And:

    file_put_contents()

提交回复
热议问题