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
9 changes: 8 additions & 1 deletion Classes/Controller/ImageRenderingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

use TYPO3\CMS\Core\Resource;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Service\ImageService;
use TYPO3\CMS\Extbase\Object\ObjectManager;

/**
* Render the image attributes and reconstruct magic images, if necessary (and possible)
Expand Down Expand Up @@ -76,6 +78,8 @@ public function renderImageAttributes($content = '', $conf)
if ($fileUid) {
try {
$file = Resource\ResourceFactory::getInstance()->getFileObject($fileUid);
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$imageService = $objectManager->get(ImageService::class);
if ($imageAttributes['src'] !== $file->getPublicUrl()) {
// Source file is a processed image
$imageConfiguration = [
Expand All @@ -84,13 +88,15 @@ public function renderImageAttributes($content = '', $conf)
];
$processedFile = $this->getMagicImageService()->createMagicImage($file, $imageConfiguration);
$additionalAttributes = [
'src' => $processedFile->getPublicUrl(),
'src' => $imageService->getImageUri($processedFile),
'title' => $imageAttributes['title'] ?: $file->getProperty('title'),
'alt' => $imageAttributes['alt'] ?: $file->getProperty('alternative'),
'width' => $processedFile->getProperty('width'),
'height' => $processedFile->getProperty('height'),
];
$imageAttributes = array_merge($imageAttributes, $additionalAttributes);
} else {
$imageAttributes['src'] = $imageService->getImageUri($file);
}
} catch (Resource\Exception\FileDoesNotExistException $fileDoesNotExistException) {
// Log the fact the file could not be retrieved.
Expand All @@ -99,6 +105,7 @@ public function renderImageAttributes($content = '', $conf)
}
}
}

return '<img ' . GeneralUtility::implodeAttributes($imageAttributes, true, true) . ' />';
}

Expand Down
2 changes: 1 addition & 1 deletion Resources/Public/JavaScript/Plugins/TableOperations.js
Original file line number Diff line number Diff line change
Expand Up @@ -1459,7 +1459,7 @@ define([
* @param {Object} params The field values entered in the form
*/
setHeaders: function (table, params) {
var headers = params.f_headers;
var headers = params.typeof;
var doc = this.editor.document;
var tbody = table.tBodies[0];
var thead = table.tHead;
Expand Down