-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Add option to exclude images from processing
- Loading branch information
1 parent
6a79bff
commit 61298a6
Showing
5 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace Sitegeist\ImageJack\Xclass; | ||
|
||
use TYPO3\CMS\Core\Resource\FileReference; | ||
use TYPO3\CMS\Core\Resource\ProcessedFile; | ||
|
||
class ImageService extends \TYPO3\CMS\Extbase\Service\ImageService | ||
{ | ||
public function applyProcessingInstructions($image, array $processingInstructions): ProcessedFile | ||
{ | ||
if (is_a($image, FileReference::class)) { | ||
if ($image->hasProperty('tx_imagejack_excluded') && $image->getProperty('tx_imagejack_excluded') === 1) { | ||
$processingInstructions['tx_imagejack_excluded'] = true; | ||
} | ||
} | ||
return parent::applyProcessingInstructions($image, $processingInstructions); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
defined('TYPO3') or die; | ||
|
||
$newFields = [ | ||
'tx_imagejack_excluded' => [ | ||
'exclude' => true, | ||
'label' => 'LLL:EXT:image_jack/Resources/Private/Language/backend.xlf:sys_file_reference.tx_imagejack_excluded', | ||
'config' => [ | ||
'type' => 'check', | ||
'renderType' => 'checkboxToggle', | ||
'default' => 0 | ||
], | ||
] | ||
]; | ||
|
||
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('sys_file_reference', $newFields); | ||
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToPalette( | ||
'sys_file_reference', | ||
'imagejackPalette', | ||
'tx_imagejack_excluded' | ||
); | ||
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes( | ||
'sys_file_reference', | ||
'--palette--;;imagejackPalette', | ||
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE | ||
); | ||
|
||
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('news')) { | ||
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToPalette( | ||
'sys_file_reference', | ||
'imageoverlayPalette', | ||
'--linebreak--,tx_imagejack_excluded', | ||
'after:crop' | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> | ||
<xliff version="1.0"> | ||
<file source-language="en" datatype="plaintext" original="messages" date="2024-03-22T11:47:18Z" product-name="image_jack"> | ||
<header/> | ||
<body> | ||
<trans-unit id="sys_file_reference.tx_imagejack_excluded" xml:space="preserve"> | ||
<source>Exclude from image_jack processing</source> | ||
</trans-unit> | ||
</body> | ||
</file> | ||
</xliff> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters