[BUGFIX] Exception on thumbnail generation in TCA 28/21328/5
authorStefan Galinski <stefan.galinski@gmail.com>
Mon, 10 Jun 2013 17:58:42 +0000 (19:58 +0200)
committerMarkus Klein <klein.t3@mfc-linz.at>
Fri, 5 Jul 2013 12:45:53 +0000 (14:45 +0200)
In order to test this you are needing a non-FAL
TCA file reference field. Just reference something
here, remove the reference in the filesystem again
and reload the TCA of the record. An exception will
be thrown, because the file isn't available anymore.

Fixes: #49009
Releases: 6.2, 6.1, 6.0
Change-Id: I6eccb3ef77de703551a64f52ab3904cead517c8a
Reviewed-on: https://review.typo3.org/21328
Reviewed-by: Markus Klein
Reviewed-by: Alexander Opitz
Reviewed-by: Ingo Pfennigstorf
Tested-by: Ingo Pfennigstorf
Tested-by: Markus Klein
typo3/sysext/backend/Classes/Form/FormEngine.php

index eb9d11c..63ef8e5 100644 (file)
@@ -2373,8 +2373,32 @@ function ' . $evalData . '(value) {
                                        } else {
                                                $rowCopy = array();
                                                $rowCopy[$field] = $imgPath;
-                                               $thumbnailCode = BackendUtility::thumbCode($rowCopy, $table, $field, $this->backPath, 'thumbs.php', $config['uploadfolder'], 0, ' align="middle"');
-                                               $imgs[] = '<span class="nobr">' . $thumbnailCode . $imgPath . '</span>';
+                                               $thumbnailCode = '';
+                                               try {
+                                                       $thumbnailCode = BackendUtility::thumbCode(
+                                                               $rowCopy, $table, $field, $this->backPath, 'thumbs.php',
+                                                               $config['uploadfolder'], 0, ' align="middle"'
+                                                       );
+                                                       $thumbnailCode = '<span class="nobr">' . $thumbnailCode . $imgPath . '</span>';
+
+                                               } catch (\Exception $exception) {
+                                                       /** @var $flashMessage FlashMessage */
+                                                       $message = $exception->getMessage();
+                                                       $flashMessage = GeneralUtility::makeInstance(
+                                                               'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
+                                                               htmlspecialchars($message), '', FlashMessage::ERROR, TRUE
+                                                       );
+                                                       $class = 'TYPO3\\CMS\\Core\\Messaging\\FlashMessageService';
+                                                       /** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */
+                                                       $flashMessageService = GeneralUtility::makeInstance($class);
+                                                       $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
+                                                       $defaultFlashMessageQueue->enqueue($flashMessage);
+
+                                                       $logMessage = $message . ' (' . $table . ':' . $row['uid'] . ')';
+                                                       GeneralUtility::sysLog($logMessage, 'core', GeneralUtility::SYSLOG_SEVERITY_WARNING);
+                                               }
+
+                                               $imgs[] = $thumbnailCode;
                                        }
                                }
                                $thumbsnail = implode('<br />', $imgs);
@@ -6312,4 +6336,4 @@ function ' . $evalData . '(value) {
 
 }
 
-?>
\ No newline at end of file
+?>