Skip to content

Commit

Permalink
[BUGFIX] #126 Wrong link in image, #142 Wrong backwards compatibility
Browse files Browse the repository at this point in the history
Fixed img src generation on first save of RTE, changed TYPO3 version constraints (fixes #126 and #142)
  • Loading branch information
cnmarco authored and CybotTM committed Dec 11, 2021
1 parent b2bb458 commit ef9164e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
14 changes: 13 additions & 1 deletion Classes/Database/RteImagesDbHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,19 @@ public function transform_db($value)
$magicImage = $magicImageService->createMagicImage($originalImageFile, $imageConfiguration);
$attribArray['width'] = $magicImage->getProperty('width');
$attribArray['height'] = $magicImage->getProperty('height');
$attribArray['src'] = $magicImage->getPublicUrl();

$imgSrc = $magicImage->getPublicUrl();

// publicUrl like 'https://www.domain.xy/typo3/image/process?token=...'?
// -> generate img source from storage basepath and identifier instead
if (strpos($imgSrc, 'process?token=') !== false) {
$storageBasePath = $magicImage->getStorage()->getConfiguration()['basePath'];
$imgUrlPre = (substr($storageBasePath, -1, 1) === '/') ? substr($storageBasePath, 0, -1) : $storageBasePath;

$imgSrc = '/' . $imgUrlPre . $magicImage->getIdentifier();
}

$attribArray['src'] = $imgSrc;
}
} elseif (!GeneralUtility::isFirstPartOfStr($absoluteUrl, $siteUrl) && !$this->procOptions['dontFetchExtPictures'] && TYPO3_MODE === 'BE') {
// External image from another URL: in that case, fetch image, unless the feature is disabled or we are not in backend mode
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"homepage": "https://www.netresearch.de",
"license": ["GPL-2.0-or-later"],
"require": {
"typo3/cms-core": "^10.2 || ^11.5"
"typo3/cms-core": "^11.5"
},
"require-dev": {
"namelesscoder/typo3-repository-client": "^1.2"
Expand Down
6 changes: 3 additions & 3 deletions ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
'clearCacheOnLoad' => 0,
'author' => 'Christian Opitz, Mathias Uhlmann',
'author_email' => 'christian.opitz@netresearch.de',
'version' => '10.1.0',
'version' => '11.0.0',
'constraints' => [
'depends' => [
'typo3' => '10.2.0-11.5.99',
'rte_ckeditor' => '10.2.0-11.5.99',
'typo3' => '11.0.0-11.5.99',
'rte_ckeditor' => '11.0.0-11.5.99',
],
'conflicts' => [],
'suggests' => [
Expand Down

0 comments on commit ef9164e

Please sign in to comment.