File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 99use Exception ;
1010use Event ;
1111use File ;
12+ use Log ;
1213use Intervention \Image \ImageManagerStatic as Image ;
1314use Validator ;
1415use Illuminate \Support \Str ;
@@ -294,7 +295,19 @@ public function initResource()
294295 throw new \Exception ('Image file does not exist (not found) ' );
295296 }
296297
297- $ this ->im = $ this ->original = Image::make ($ this ->image );
298+ // Auto Rotate based on exif data
299+ if ($ this ->options ['orientate ' ] ?? false ) {
300+ try {
301+ $ this ->im = $ this ->original = Image::make ($ this ->image )->orientate ();
302+ } catch (\Throwable $ e ) {
303+ Log::debug ('Failed to fix orientation for image ' . $ this ->getImagePath () . ' (Is PHP compiled with `--enable-exif`?) ' );
304+ }
305+ }
306+
307+ // If no orientation requested (or orientation failed)
308+ if (empty ($ this ->im )) {
309+ $ this ->im = $ this ->original = Image::make ($ this ->image );
310+ }
298311 } catch (\Exception $ e ) {
299312 if ($ this ->allowDefaultImage ) {
300313 $ this ->setFormatCache ([]);
Original file line number Diff line number Diff line change 55552.2.4 :
5656 - Fix exception when directory doesn't exist during cache clear
57572.2.5 :
58- - Fix regeneration of permalink images that previously defaulted to 404 image
58+ - Fix regeneration of permalink images that previously defaulted to 404 image
59+ 2.3.0 :
60+ - Add Orientate Option to read exif and orientate automatically
You can’t perform that action at this time.
0 commit comments