netresearch / t3x-rte_ckeditor_image

Image support in CKEditor for the TYPO3 ecosystem
GNU Affero General Public License v3.0
56 stars 65 forks source link

Width of imgages in CKeditor after recreation (deletion of fileadmin/_processed) is always 300 #286

Closed bigahuna closed 6 months ago

bigahuna commented 6 months ago

Bug description

In page.tsconfig we can set the default maxWidth and maxHeight for magic images like this:

RTE.default.buttons.image.options.magic.maxWidth = 1920
RTE.default.buttons.image.options.magic.maxHeight = 1280

If all files inside fileadmin/_processed_ are deleted and a CKeditor instance with relations to fileadmin/_processed_ is saved, all newly created proessed images have a width of 300. This means, the tsconfig settings are ignored.

The reason for this can be found in rte-ckeditor-image/Classes/Database/RteImagesDbHook.php line 289:

$magicImageService->setMagicImageMaximumDimensions($pageTsConfig['TCEFORM.']['RTE.']['default.'] ?? []);

The path in the array $pageTsConfig['TCEFORM.']['RTE.']['default.'] does not exist, it should be $pageTsConfig['RTE.']['default.'] (remove TCEFORM). See https://docs.typo3.org/p/friendsoftypo3/rtehtmlarea/main/en-us/Configuration/PageTsconfig/interfaceConfiguration/Index.html#buttons-image-options-magic-maxwidth

So if we pass non existent values to typo3/cms-core/Classes/Resource/Service/MagicImageService.php->setMagicImageMaximumDimensions(), all images will be created with the default magicImageMaximumWidth of 300 (see class variables in MagicImageService.php)

Steps to reproduce Delete all files inside fileadmin/_processed', open a CKeditor with magic images and click save. Now they will be recreated but they will all have a width of max 300

Expected behavior Create images with the maxWidth and maxHeigth values configured in page.tsconfig

Environment

Documentation Have you checked the readme/documentation?

Gitsko commented 6 months ago

Thank you very much, I have fixed the MR, so everything should now fit again.