From 63a2a917dae2bb03097aae19029446d9dddaec0b Mon Sep 17 00:00:00 2001
From: Joschi Kuphal <joschi@tollwerk.de>
Date: Wed, 22 Nov 2017 10:53:06 +0100
Subject: [PATCH] [BUGFIX] Add missing initialization of GraphicalFunctions

Add missing initialization of the GraphicalFunctions helper
during image processing.

Resolves: #83058
Releases: master, 8.7
Change-Id: Ic5552c573f866faf3dcb0e0bc11012d83c805033
Reviewed-on: https://review.typo3.org/54717
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
---
 .../Resource/OnlineMedia/Processing/PreviewProcessing.php       | 1 +
 .../core/Classes/Resource/Processing/LocalImageProcessor.php    | 1 +
 .../core/Classes/Resource/Processing/LocalPreviewHelper.php     | 2 ++
 typo3/sysext/core/Classes/Type/File/ImageInfo.php               | 1 +
 4 files changed, 5 insertions(+)

diff --git a/typo3/sysext/core/Classes/Resource/OnlineMedia/Processing/PreviewProcessing.php b/typo3/sysext/core/Classes/Resource/OnlineMedia/Processing/PreviewProcessing.php
index faecdb5cff51..938d54ec4557 100644
--- a/typo3/sysext/core/Classes/Resource/OnlineMedia/Processing/PreviewProcessing.php
+++ b/typo3/sysext/core/Classes/Resource/OnlineMedia/Processing/PreviewProcessing.php
@@ -247,6 +247,7 @@ class PreviewProcessing
         static $graphicalFunctionsObject = null;
         if ($graphicalFunctionsObject === null) {
             $graphicalFunctionsObject = GeneralUtility::makeInstance(GraphicalFunctions::class);
+            $graphicalFunctionsObject->init();
         }
         return $graphicalFunctionsObject;
     }
diff --git a/typo3/sysext/core/Classes/Resource/Processing/LocalImageProcessor.php b/typo3/sysext/core/Classes/Resource/Processing/LocalImageProcessor.php
index 465903d0d1e8..7c2c412e4fb6 100644
--- a/typo3/sysext/core/Classes/Resource/Processing/LocalImageProcessor.php
+++ b/typo3/sysext/core/Classes/Resource/Processing/LocalImageProcessor.php
@@ -162,6 +162,7 @@ class LocalImageProcessor implements ProcessorInterface
 
         if ($graphicalFunctionsObject === null) {
             $graphicalFunctionsObject = GeneralUtility::makeInstance(GraphicalFunctions::class);
+            $graphicalFunctionsObject->init();
         }
 
         return $graphicalFunctionsObject;
diff --git a/typo3/sysext/core/Classes/Resource/Processing/LocalPreviewHelper.php b/typo3/sysext/core/Classes/Resource/Processing/LocalPreviewHelper.php
index a90d7535f88a..6f804ac3511c 100644
--- a/typo3/sysext/core/Classes/Resource/Processing/LocalPreviewHelper.php
+++ b/typo3/sysext/core/Classes/Resource/Processing/LocalPreviewHelper.php
@@ -103,6 +103,7 @@ class LocalPreviewHelper
         ) {
             // Create a default image
             $graphicalFunctions = GeneralUtility::makeInstance(GraphicalFunctions::class);
+            $graphicalFunctions->init();
             $graphicalFunctions->getTemporaryImageWithText(
                 $targetFilePath,
                 'Not imagefile!',
@@ -138,6 +139,7 @@ class LocalPreviewHelper
                 if (!file_exists($targetFilePath)) {
                     // Create an error gif
                     $graphicalFunctions = GeneralUtility::makeInstance(GraphicalFunctions::class);
+                    $graphicalFunctions->init();
                     $graphicalFunctions->getTemporaryImageWithText(
                         $targetFilePath,
                         'No thumb',
diff --git a/typo3/sysext/core/Classes/Type/File/ImageInfo.php b/typo3/sysext/core/Classes/Type/File/ImageInfo.php
index e5072ee769a5..a630063319be 100644
--- a/typo3/sysext/core/Classes/Type/File/ImageInfo.php
+++ b/typo3/sysext/core/Classes/Type/File/ImageInfo.php
@@ -117,6 +117,7 @@ class ImageInfo extends FileInfo implements LoggerAwareInterface
 
         if ($graphicalFunctions === null) {
             $graphicalFunctions = GeneralUtility::makeInstance(GraphicalFunctions::class);
+            $graphicalFunctions->init();
         }
 
         return $graphicalFunctions;
-- 
GitLab