‪TYPO3CMS  ‪main
ImageProcessingStatus.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
18 use TYPO3\CMS\Core\Imaging\GraphicalFunctions;
24 
29 {
35  public function ‪getStatus(): array
36  {
37  return [
38  'webp' => $this->‪getMissingFilesStatus(),
39  ];
40  }
41 
42  public function ‪getLabel(): string
43  {
44  return 'imageprocessing';
45  }
46 
50  protected function ‪getMissingFilesStatus(): ‪Status
51  {
52  $imageProcessing = GeneralUtility::makeInstance(GraphicalFunctions::class);
53  if (!$imageProcessing->isProcessingEnabled()) {
54  $severity = ContextualFeedbackSeverity::INFO;
55  $value = $this->‪getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_disabled');
56  $message = $this->‪getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_imageprocessing_disabled');
57  // ImageMagick / GraphicsMagick is not enabled, all good
58  } elseif (!in_array('webp', $imageProcessing->getImageFileExt(), true)) {
59  // webp is not enabled in TYPO3's Configuration
60  $severity = ContextualFeedbackSeverity::INFO;
61  $message = $this->‪getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_imageprocessing_webp_not_configured');
62  $value = $this->‪getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_disabled');
63  // But ImageMagick can do it, maybe it could be activated
64  if ($imageProcessing->webpSupportAvailable()) {
65  $message = $this->‪getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_imageprocessing_webp_available');
66  }
67  } elseif (!$imageProcessing->webpSupportAvailable()) {
68  // webp is configured to be available, but ImageMagick/GraphicsMagick does not support this.
69  $severity = ContextualFeedbackSeverity::WARNING;
70  $message = $this->‪getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_imageprocessing_webp_not_available');
71  $value = $this->‪getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_enabled');
72  } else {
73  // webp is configured to be available, and ImageMagick/GraphicsMagick supports this.
74  $severity = ContextualFeedbackSeverity::OK;
75  $message = $this->‪getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_imageprocessing_webp_available_and_configured');
76  $value = $this->‪getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_enabled');
77  }
78 
79  return new ‪Status(
80  $this->‪getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_imageprocessing_webp'),
81  $value,
82  $message,
83  $severity
84  );
85  }
86 
88  {
89  return ‪$GLOBALS['LANG'];
90  }
91 }
‪TYPO3\CMS\Reports\Report\Status\ImageProcessingStatus\getMissingFilesStatus
‪getMissingFilesStatus()
Definition: ImageProcessingStatus.php:50
‪TYPO3\CMS\Reports\StatusProviderInterface
Definition: StatusProviderInterface.php:22
‪TYPO3\CMS\Reports\Report\Status\Status
Definition: Status.php:34
‪TYPO3\CMS\Reports\Report\Status\ImageProcessingStatus\getLabel
‪getLabel()
Definition: ImageProcessingStatus.php:42
‪TYPO3\CMS\Core\Type\ContextualFeedbackSeverity
‪ContextualFeedbackSeverity
Definition: ContextualFeedbackSeverity.php:25
‪TYPO3\CMS\Reports\Status
Definition: Status.php:24
‪TYPO3\CMS\Reports\Report\Status\ImageProcessingStatus\getLanguageService
‪getLanguageService()
Definition: ImageProcessingStatus.php:87
‪TYPO3\CMS\Reports\Report\Status\ImageProcessingStatus
Definition: ImageProcessingStatus.php:29
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Reports\Report\Status
Definition: ConfigurationStatus.php:16
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:46
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52
‪TYPO3\CMS\Reports\Report\Status\ImageProcessingStatus\getStatus
‪Status[] getStatus()
Definition: ImageProcessingStatus.php:35