[BUGFIX] Fix thumbnail display for IRRE records 44/27844/5
authorAlexander Stehlik <alexander.stehlik@gmail.com>
Fri, 14 Mar 2014 11:39:05 +0000 (12:39 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Fri, 14 Mar 2014 22:35:37 +0000 (23:35 +0100)
The system will only generate a thumbnail for IRRE records if the
related file object is an image file.

Additionally the UID of the file reference will be used as alternative
text and as title for the thumbnail so that it behaves like the icon
that is used for non-image files.

Resolves: #56274
Releases: 6.2
Change-Id: Ibe6530368434c384d5b7cca93e81b656c8c56383
Reviewed-on: https://review.typo3.org/27844
Reviewed-by: Frans Saris
Tested-by: Frans Saris
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
typo3/sysext/backend/Classes/Form/Element/InlineElement.php

index c06229d..20b399f 100644 (file)
@@ -596,8 +596,12 @@ class InlineElement {
                                        $imageSetup = $config['appearance']['headerThumbnail'];
                                        unset($imageSetup['field']);
                                        $imageSetup = array_merge(array('width' => '45', 'height' => '45c'), $imageSetup);
-                                       $imageUrl = $fileObject->process(\TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGECROPSCALEMASK, $imageSetup)->getPublicUrl(TRUE);
-                                       $thumbnail = '<img class="t3-form-field-header-inline-thumbnail-image" src="' . $imageUrl . '" alt="' . htmlspecialchars($recTitle) . '">';
+                                       $processedImage = $fileObject->process(\TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGECROPSCALEMASK, $imageSetup);
+                                       // Only use a thumbnail if the processing was successful.
+                                       if (!$processedImage->usesOriginalFile()) {
+                                               $imageUrl = $processedImage->getPublicUrl(TRUE);
+                                               $thumbnail = '<img class="t3-form-field-header-inline-thumbnail-image" src="' . $imageUrl . '" alt="' . htmlspecialchars($altText) . '" title="' . htmlspecialchars($altText) . '">';
+                                       }
                                }
                        }
                }