Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion Classes/Service/ImageResizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no blank space before $orientation in CGL

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, can be done, i leave that up to you :-)


Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please drop all those useless line breaks between cases, they do not bring anything and are not used either in the rest of the codebase.

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 (
Expand Down
8 changes: 7 additions & 1 deletion Configuration/TCA/Module/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@
'type' => 'check',
],
],
'auto_orient_custom' => [
Comment thread
tobiasgraeber marked this conversation as resolved.
'label' => 'Use custom auto_orient (flop rotate 6 and 8 handling, based on image exif)',

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

=> Use a LLL:EXT (XLIFF) label

Furthermore, I'd suggest to add a description field with some further details, such as a (textual) link explaining the problematic with some pieces of software.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, can be done, i leave that up to you :-)

'config' => [
'type' => 'check',
],
],
'keep_metadata' => [
'label' => 'LLL:EXT:image_autoresize/Resources/Private/Language/locallang_tca.xlf:tx_imageautoresize.keep_metadata',
'config' => [
Expand Down Expand Up @@ -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,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is fully related to auto_orient, I'd suggest to group both "auto autorientation" options in a single palette instead

--div--;LLL:EXT:image_autoresize/Resources/Private/Language/locallang_tca.xlf:tabs.rulesets,
rulesets
'],
Expand Down