<?php if ($request['upload_image']) { $file = $request->file('upload_image'); $name = $file->getClientOriginalName(); $save_path = storage_path('app/'); /** * 対応としては、写真自体をEXIFのOrientationをもとに適宜回転したのち * ウェブサービス側で保存・さらにEXIFのOrientation情報を削除します。 */ /** * [1] * 写真自体をEXIFのOrientationをもとに適宜回転したのち */ $image = \Image::make($file)->orientate(); $tmp_dir = $image->dirname; $tmp_filename = $image->filename; $combine = $tmp_dir . '/' . $tmp_filename; /** * [2] * exif削除 */ exec('/usr/bin/exiftool -all= '. $combine); // dd($image->exif()); // dd($image->exif('Orientation')); $image->resize(1400, null, function ($constraint) { $constraint->aspectRatio(); }); $image->save($save_path.$name); }