t3x-rte_ckeditor_image
t3x-rte_ckeditor_image copied to clipboard
No processed files are generated (backend and frontend)
Bug description
If an image is added inside the backend editor, after saving the element, the generated html looks like this:
CKEditor
<img class="" src="/fileadmin/user_upload/myorgimage.jpg" data-htmlarea-file-uid="126" data-htmlarea-file-table="sys_file" width="500" height="312" title="" alt="" data-title-override="true" data-alt-override="true">
But from my understanding, the src-attribute should be something like this instead:
src="/fileadmin/_processed_/7/c/csm_myorgimage_21d544ce31.jpg"
Because the src is not a link to a processed image, the rendering in the frontend does not use a processed image either. The same content rendered in the frontend looks like this:
Frontend
<img class="" src="/fileadmin/user_upload/Bilder_Banner/About_1_6x1_1MB.jpg" data-htmlarea-file-uid="126" data-htmlarea-file-table="sys_file" width="500" height="312" title="" alt="" data-title-override="true" data-alt-override="true" style="">
In netresearch/rte-ckeditor-image/Classes/Controller/ImageRenderingController.php
in line 81 there is the following condition
if ($imageSource !== $systemImage->getPublicUrl()) {}
Because $imageSource and $systemImage->getPublicUrl() are both /fileadmin/user_upload/myorgimage.jpg, we will never get a processed image here.
We took a look into netresearch/rte-ckeditor-image/Resources/Public/JavaScript/Plugins/typo3image.js
and found this code
$.extend(filteredAttr, {
src: urlToRelative(getImg.url),
width: getImg.processed.width || getImg.width,
height: getImg.processed.height || getImg.height,
fileUid: img.uid,
fileTable: table
});
If we change src: urlToRelative(getImg.url),
to src: urlToRelative(getImg.processed.url),
, at least the image will be saved as a processed file (getImg.processed contains all the data of the correct processed file) in the Ckeditor. I do not know what other side effects this will trigger... This also creates a processed file in the frontend.
Steps to reproduce To reproduce the problem:
- add a image inside the backend editor, set an individual size (smaller then the original) and save
- look at the generated source code inside the editor and check if the image path links to a fileadmin/_processed image or to the original, not processed file
- open the same page in the frontend and look at the path of the image and check if it links to a fileadmin/_processed image
Expected behavior If a image is added in the Ckeditor and an individual size (smaller then the original) is set, the image should be processed and an image with the new size should be created inside fileadmin/_processed
Environment
- TYPO3 version: v12.4.14
- PHP version: 8.1
- Extension version: v12.0.1
Documentation Have you checked the readme/documentation?
- [X ] Yes, but I couldn't find anything helpful