我试图获取图像exif数据,以便我可以使用图像干预定向功能.
唯一的问题是我无法使用Storage :: get()读取exif数据
首先,我存储Uploaded图像,如下所示:
$filename = uniqid().'.'.$file->getClientOriginalExtension();
$path = "images/$id/$filename";
Storage::put($path, File::get($file->getRealPath()));
Run Code Online (Sandbox Code Playgroud)
在队列中我正在读取图像,进行一些调整大小并上传到AWS:
$image = Image::make(Storage::disk('images')->get("$this->id/$file"));
$image->orientate();
$image->resize(null, 600, function ($constraint) {
$constraint->aspectRatio();
});
$image->stream('jpg', 85);
Storage::put("images/$this->id/main/$file", $image);
$image->destroy();
Run Code Online (Sandbox Code Playgroud)
图像确实调整大小并上传到AWS,但唯一的问题是它会向侧面显示,所以我似乎无法使用以下方法读取exif数据:
Storage::disk('images')->get("$this->id/$file")
Run Code Online (Sandbox Code Playgroud)
我跑了:php -m | 更多,我可以看到列出"exif",所以我在Laravel Forge DO服务器上有模块
小智 0
要从图像干预中获取 exif 数据,您必须运行该exif()函数
很简单,只需添加:
$image->exif();
Run Code Online (Sandbox Code Playgroud)
该exif()函数将返回 array() 中的所有现有数据;
您可以将参数传递给exif()函数,该函数将返回字符串中的一些信息,例如:$image->exif('model')
您可以在图像干预网站上阅读更多相关信息