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'); }
扫码二维码 获取免费视频学习资料
- 本文固定链接: http://phpxs.com/post/6777/
- 转载请注明:转载必须在正文中标注并保留原文链接
- 扫码: 扫上方二维码获取免费视频资料
查 看2022高级编程视频教程免费获取