<?php
class fileAction
{
	/**
	  * @method 旋转图片
	  * @http  post
	  * @param  image     string  [必填] 图片内容base64
	  * @param  rotate    int  [必填] 90 180 270
	  * @author soul
	  * @copyright 2023/4/3
	  * @return
			
	  */
	public function rotateImg()
	{
		$image = $_POST['image'];
		$rotate = $_POST['rotate'];
		if($rotate > 0)
		{
			$OthImg = new OthImg(100);
			$tempFile = mvc::$cfg['PATH_CACHE'].md5($image).'_'.$rotate.'.jpg';
			file_put_contents($tempFile, base64_decode($image));
			$OthImg->rotate($tempFile, $tempFile, $rotate, '#ffffff');
			$image = base64_encode(file_get_contents($tempFile));
			@unlink($tempFile);
		}
		echo $image;
	}
}