How to rotate image and save the image

前端 未结 5 1983
予麋鹿
予麋鹿 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:43

    You can try my solution to rotate the image

    _path = $path;
            $this->_degrees = $degrees;
        }
    
        public function rotate() {
            $image = new Imagick($this->_path);
            $image->rotateimage('black', $this->_degrees);
            echo $image->getImageBlob();
            exit();
        }
    
    
    }
    
    
    
    if($_SERVER['REQUEST_METHOD'] == 'GET'){
        $sourceImagePath = isset($_GET['image_path']) ? $_GET['image_path'] : null;
        $degrees = isset($_GET['degrees']) ? $_GET['degrees'] : 90;
    
        $obj = new RotateImage($sourceImagePath, $degrees);
        return $obj->rotate();
    }
    ?>
    

提交回复
热议问题