xperseguers / t3ext-image_autoresize

TYPO3 Extension image_autoresize. Simplify the way your editors may upload their images.
https://extensions.typo3.org/extension/image_autoresize
GNU General Public License v3.0
16 stars 23 forks source link

Feature request: force conversion #44

Open webian opened 4 years ago

webian commented 4 years ago

It happens that a PNG is uploaded but not converted because transparency is detected even if visually there's no transparency. In this cases a button to force the conversion to JPG of a single image would be useful.

DavidBruchmann commented 4 years ago

I could imagine several cases where conversion and/or manipulation might be desired. Question is if a single checkbox might be the way to go or if there should be a more general approach implemented where it could be configured which options to use or to offer, perhaps even with a hook that could be used by further extensions.

xperseguers commented 4 years ago

Well, there's already a checkbox to convert regardless of alpha channel and this could be enabled for a given directory as well. So having a hook/signal to allow to override configuration will probably be quite complex as it means that somehow you need to understand by code that alpha channel is useless or can safely be forgotten in a specific case. Sounds quite complex.

Adding a button to force conversion sounds like the best approach but is imho not the core business of this extension. So did you try to create that button and manually invoke the resizing based on configuration? Something like:

$imageResizer = GeneralUtility::makeInstance(ImageResizer::class);
$configuration = ConfigurationController::readConfiguration();
$imageResizer->initializeRulesets($configuration);

// Actual resizing
$imageResizer->processFile(...)

Possibly we need to add some helper methods to quickly override the configuration in that case or to decouple ->processFile() a bit more to get finer-grained access to the workflow.

xperseguers commented 3 years ago

The best approach would possibly be a button in File > List next to each image which shows a dialog where one can manually resize to any dimensions, allowing to "force" in case of PNG transparency, but this is quite some work and will require a PR.