[BUGFIX] Element browser doesn't use FAL info to for file dimensions 04/28404/2
authorFrans Saris <franssaris@gmail.com>
Fri, 14 Mar 2014 21:46:00 +0000 (22:46 +0100)
committerBenjamin Mack <benni@typo3.org>
Tue, 18 Mar 2014 07:46:28 +0000 (08:46 +0100)
The dimensions of a file are fetch during indexing. These values
should be used as for remote files or certain filetype getimagesize()
will not work or give unwanted overhead.

Resolves: #56864
Releases: 6.2
Change-Id: I14ece9c0dbf414f4cb0759d3065a1c5b5782ca29
Reviewed-on: https://review.typo3.org/28404
Reviewed-by: Markus Klein
Reviewed-by: Tomita Militaru
Reviewed-by: Wouter Wolters
Reviewed-by: Dmitry Dulepov
Tested-by: Dmitry Dulepov
Tested-by: Markus Klein
typo3/sysext/recordlist/Classes/Browser/ElementBrowser.php

index 3e29b4e..cdfee0f 100644 (file)
@@ -1882,12 +1882,6 @@ class ElementBrowser {
                                        <td colspan="4">No files found.</td>
                                </tr>';
                }
-               // Init graphic object for reading file and image dimensions:
-               /** @var $imgObj \TYPO3\CMS\Core\Imaging\GraphicalFunctions */
-               $imgObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Imaging\\GraphicalFunctions');
-               $imgObj->init();
-               $imgObj->mayScaleUp = 0;
-               $imgObj->tempPath = PATH_site . $imgObj->tempPath;
                // Traverse the file list:
                /** @var $fileObject \TYPO3\CMS\Core\Resource\File */
                foreach ($files as $fileObject) {
@@ -1899,7 +1893,10 @@ class ElementBrowser {
                                        \TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGEPREVIEW,
                                        array('width' => 64, 'height' => 64)
                                )->getPublicUrl(TRUE);
-                               $imgInfo = $imgObj->getImageDimensions($fileObject->getForLocalProcessing(FALSE));
+                               $imgInfo = array(
+                                       $fileObject->getProperty('width'),
+                                       $fileObject->getProperty('height')
+                               );
                                $pDim = $imgInfo[0] . 'x' . $imgInfo[1] . ' pixels';
                                $clickIcon = '<img src="' . $imageUrl . '" hspace="5" vspace="5" border="1" />';
                        } else {
@@ -2135,7 +2132,10 @@ class ElementBrowser {
                        // Show only web-images
                        $fileExtension = strtolower($fileObject->getExtension());
                        if (GeneralUtility::inList('gif,jpeg,jpg,png', $fileExtension)) {
-                               $imgInfo = @getimagesize($fileObject->getForLocalProcessing(FALSE));
+                               $imgInfo = array(
+                                       $fileObject->getProperty('width'),
+                                       $fileObject->getProperty('height')
+                               );
                                $pDim = $imgInfo[0] . 'x' . $imgInfo[1] . ' pixels';
                                $size = ' (' . GeneralUtility::formatSize($fileObject->getSize()) . 'bytes' . ($pDim ? ', ' . $pDim : '') . ')';
                                $filenameAndIcon = IconUtility::getSpriteIconForResource($fileObject, array('title' => $fileObject->getName() . $size));