getSourceFile()->getNameWithoutExtension() . '_' . $this->getConfigurationChecksum() . '.' . $this->getTargetFileExtension(); } /** * Determines the file extension the processed file * should have in the filesystem. */ public function getTargetFileExtension(): string { if (!isset($this->targetFileExtension)) { $this->targetFileExtension = $this->determineTargetFileExtension(); } return $this->targetFileExtension; } /** * Gets the file extension the processed file should * have in the filesystem by either using the configuration * setting, or the extension of the original file. */ protected function determineTargetFileExtension(): string { if (!empty($this->configuration['fileExtension'])) { return $this->configuration['fileExtension']; } // @todo - See note of determineDefaultProcessingFileExtension() - find a better place for this $imageService = GeneralUtility::makeInstance(GraphicalFunctions::class); return $imageService->determineDefaultProcessingFileExtension($this->getSourceFile()->getExtension()); } /** * Enforce default configuration for preview processing here, * to be sure we find already processed files below, * which we wouldn't if we would change the configuration later, as configuration is part of the lookup. */ public function sanitizeConfiguration(): void { $configuration = array_replace( [ 'width' => 64, 'height' => 64, ], $this->configuration ); $configuration['width'] = MathUtility::forceIntegerInRange($configuration['width'], 1, 1000); $configuration['height'] = MathUtility::forceIntegerInRange($configuration['height'], 1, 1000); $this->configuration = array_filter( $configuration, static function (string|int|bool|array|null $value, string $name): bool { return !empty($value) && in_array($name, ['width', 'height'], true); }, ARRAY_FILTER_USE_BOTH ); parent::sanitizeConfiguration(); } }