yii2 图片处理插件Imagine

use Imagine\Image\ManipulatorInterface;
use yii\imagine\Image;
 
public function actionPhoto()
{
    //剪切
    Image::crop('./image/1.jpg', 1000, 1000,[500,500])
        ->save('./image/1_crop.jpg');
 
 
    //旋转
    Image::frame('./image/1.jpg', 5, '666', 0)
            ->rotate(-8)
            ->save('./image/1_rotate.jpg', ['quality' => 50]);
 
 
    //压缩
    Image::thumbnail('./image/1.jpg', 100, 50,ManipulatorInterface::THUMBNAIL_OUTBOUND)
            ->save('./image/1_thumb.jpg');
 
 
    //图片水印
    Image::watermark('./image/1.jpg', './image/1_thumb.jpg', [10,10])
            ->save('./image/1_water.jpg');
 
 
    //文字水印
     Image::text('./image/1.jpg', 'hello world', 'glyphicons-halflings-regular.ttf',[10,10],[])
            ->save('./image/1_text.jpg');
}