[FEATURE] Video player in backend (i) window
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Classes / Controller / ContentElement / ElementInformationController.php
index 949c662..839790f 100644 (file)
@@ -241,38 +241,52 @@ class ElementInformationController {
                if (!$this->fileObject) {
                        return;
                }
-               $imageTag = '';
+
+               $previewTag = '';
                $downloadLink = '';
 
                // check if file is marked as missing
                if ($this->fileObject->isMissing()) {
                        $flashMessage = \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($this->fileObject);
-                       $imageTag .= $flashMessage->render();
+                       $previewTag .= $flashMessage->render();
 
                } else {
 
+                       /** @var \TYPO3\CMS\Core\Resource\Rendering\RendererRegistry $rendererRegistry */
+                       $rendererRegistry = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\Rendering\\RendererRegistry');
+                       $fileRenderer = $rendererRegistry->getRenderer($this->fileObject);
                        $fileExtension = $this->fileObject->getExtension();
-                       $thumbUrl = '';
-                       if (GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $fileExtension)) {
+                       $url = $this->fileObject->getPublicUrl(TRUE);
+
+                       // Check if there is a FileRenderer
+                       if ($fileRenderer !== NULL) {
+                               $previewTag = $fileRenderer->render(
+                                       $this->fileObject,
+                                       '590m',
+                                       '400m',
+                                       array(),
+                                       TRUE
+                               );
+
+                       // else check if we can create an Image preview
+                       } elseif (GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $fileExtension)) {
                                $thumbUrl = $this->fileObject->process(
                                        ProcessedFile::CONTEXT_IMAGEPREVIEW,
                                        array(
-                                               'width' => '400m',
+                                               'width' => '590m',
                                                'height' => '400m'
                                        )
                                )->getPublicUrl(TRUE);
-                       }
 
-                       // Create thumbnail image?
-                       if ($thumbUrl) {
-                               $imageTag .= '<img src="' . $thumbUrl . '" ' .
+                               // Create thumbnail image?
+                               if ($thumbUrl) {
+                                       $previewTag .= '<img src="' . $thumbUrl . '" ' .
                                                'alt="' . htmlspecialchars(trim($this->fileObject->getName())) . '" ' .
                                                'title="' . htmlspecialchars(trim($this->fileObject->getName())) . '" />';
+                               }
                        }
 
-                       // Display download link?
-                       $url = $this->fileObject->getPublicUrl(TRUE);
-
+                       // Download
                        if ($url) {
                                $downloadLink .= '<a href="' . htmlspecialchars($url) . '" target="_blank" class="t3-button">' .
                                                IconUtility::getSpriteIcon('actions-edit-download') . ' ' .
@@ -281,7 +295,7 @@ class ElementInformationController {
                        }
                }
 
-               return ($imageTag ? '<p>' . $imageTag . '</p>' : '') .
+               return ($previewTag ? '<p>' . $previewTag . '</p>' : '') .
                                ($downloadLink ? '<p>' . $downloadLink . '</p>' : '');
        }