diff --git a/Classes/Service/ImageResizer.php b/Classes/Service/ImageResizer.php index 037edde1..fdad6f80 100644 --- a/Classes/Service/ImageResizer.php +++ b/Classes/Service/ImageResizer.php @@ -310,7 +310,41 @@ public function processFile( if ((bool)$ruleset['auto_orient'] === true) { $orientation = ImageUtility::getOrientation($fileName); $isRotated = ImageUtility::isRotated($orientation); - $gifCreator->scalecmd = '-auto-orient ' . $gifCreator->scalecmd; + + if ((bool)$ruleset['auto_orient_custom'] === true) { + switch ((int) $orientation) { + + case 2: + $gifCreator->scalecmd = '-flop'; + break; + + case 3: + $gifCreator->scalecmd = '-rotate 180'; + break; + + case 4: + $gifCreator->scalecmd = '-rotate 180 -flop'; + break; + + case 5: + $gifCreator->scalecmd = '-rotate -90 -flop'; + break; + + case 6: + $gifCreator->scalecmd = '-rotate -90'; + break; + + case 7: + $gifCreator->scalecmd = '-rotate 90 -flop'; + break; + + case 8: + $gifCreator->scalecmd = '-rotate 90'; + break; + } + } else { + $gifCreator->scalecmd = '-auto-orient ' . $gifCreator->scalecmd; + } } if ( diff --git a/Configuration/TCA/Module/Options.php b/Configuration/TCA/Module/Options.php index 77195645..842d1d4c 100644 --- a/Configuration/TCA/Module/Options.php +++ b/Configuration/TCA/Module/Options.php @@ -85,6 +85,12 @@ 'type' => 'check', ], ], + 'auto_orient_custom' => [ + 'label' => 'Use custom auto_orient (flop rotate 6 and 8 handling, based on image exif)', + 'config' => [ + 'type' => 'check', + ], + ], 'keep_metadata' => [ 'label' => 'LLL:EXT:image_autoresize/Resources/Private/Language/locallang_tca.xlf:tx_imageautoresize.keep_metadata', 'config' => [ @@ -121,7 +127,7 @@ 'directories,threshold,file_types, --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:ALT.imgDimensions;dimensions, --div--;LLL:EXT:image_autoresize/Resources/Private/Language/locallang_tca.xlf:tabs.options, - auto_orient,keep_metadata,resize_png_with_alpha,conversion_mapping, + auto_orient,auto_orient_custom,keep_metadata,resize_png_with_alpha,conversion_mapping, --div--;LLL:EXT:image_autoresize/Resources/Private/Language/locallang_tca.xlf:tabs.rulesets, rulesets '],