Commit 93ac43c7 authored by Guido Schmechel's avatar Guido Schmechel Committed by Christian Kuhn
Browse files

[BUGFIX] Use custom image file extensions for image processing tests

If an integrator removes image file extensions, e.g. "gif", from
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] the whole image
processing test in the install tool fails.

That's because some tests need to run independent of the global
configuration. Therefore the GraphicalFunctions class, which is
used as the image processor, now features a setter. This allows
EXT:install to manually define required image extensions for the
tests, which should not consider the global configuration.

Note: The `convertImageFormatsToJpg` test, which tries to
convert every defined image file extension (based on the
global configuration) to JPG, is not affected by this change.

Resolves: #92958
Releases: master, 10.4
Change-Id: Ic84be73c897f497fedd6b442965edf6fb3ef88c3
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/67344

Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: default avatarMartin Kutschker <mkutschker-typo3@yahoo.com>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: default avatarMartin Kutschker <mkutschker-typo3@yahoo.com>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 73c81341
......@@ -1192,6 +1192,15 @@ class GraphicalFunctions
return $sF;
}
/**
* @param array $imageFileExt
* @internal Only used for ext:install, not part of TYPO3 Core API.
*/
public function setImageFileExt(array $imageFileExt): void
{
$this->imageFileExt = $imageFileExt;
}
/**
* Renders a regular text and takes care of a possible line break automatically.
*
......
......@@ -51,6 +51,8 @@ use TYPO3\CMS\Install\SystemEnvironment\SetupCheck;
*/
class EnvironmentController extends AbstractController
{
private const IMAGE_FILE_EXT = ['gif', 'jpg', 'png', 'tif', 'ai', 'pdf'];
/**
* @var LateBootService
*/
......@@ -911,6 +913,7 @@ class EnvironmentController extends AbstractController
$imageProcessor->filenamePrefix = 'installTool-';
$imageProcessor->dontCompress = true;
$imageProcessor->alternativeOutputKey = 'typo3InstallTest';
$imageProcessor->setImageFileExt(self::IMAGE_FILE_EXT);
return $imageProcessor;
}
......@@ -1086,10 +1089,10 @@ class EnvironmentController extends AbstractController
'success' => true,
];
foreach ($testResult as $resultKey => $value) {
if ($resultKey === 'referenceFile') {
if ($resultKey === 'referenceFile' && !empty($testResult['referenceFile'])) {
$fileExt = end(explode('.', $testResult['referenceFile']));
$responseData['referenceFile'] = 'data:image/' . $fileExt . ';base64,' . base64_encode((string)file_get_contents($testResult['referenceFile']));
} elseif ($resultKey === 'outputFile') {
} elseif ($resultKey === 'outputFile' && !empty($testResult['outputFile'])) {
$fileExt = end(explode('.', $testResult['outputFile']));
$responseData['outputFile'] = 'data:image/' . $fileExt . ';base64,' . base64_encode((string)file_get_contents($testResult['outputFile']));
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment