intervention/image和oss结合使用
使用 Intervention/image
扩展包来创建处理图片,处理之后我们可以直接将处理好的图片上传到 oss.
$file = request()->file('file_name');
$img = Image::make($file)->orientate();//读取EXIF图像配置项 '方向',并对图像执行旋转,以正确显示图像
$resource = $img->stream()->__toString();//这样可以获取校正后图片的二进制资源
//后面就是拿到$resource上传到oss
本作品采用《CC 协议》,转载必须注明作者和本文链接
推荐文章: