[TASK] Filelist: Info dialog shows image dimensions 75/51275/3
authorMichael Oehlhof <typo3@oehlhof.de>
Wed, 28 Dec 2016 08:03:36 +0000 (09:03 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 11 Jan 2017 21:49:59 +0000 (22:49 +0100)
The file info modal now contains the width and height of images

Resolves: #65822
Releases: master, 7.6
Change-Id: Iadb64ae3db4558bf74f15aaeac1fe29848120563
Reviewed-on: https://review.typo3.org/51275
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Classes/Controller/ContentElement/ElementInformationController.php
typo3/sysext/lang/locallang_general.xlf

index a48cf3a..af85ff9 100644 (file)
@@ -20,6 +20,7 @@ use TYPO3\CMS\Backend\Backend\Avatar\Avatar;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Imaging\Icon;
 use TYPO3\CMS\Core\Imaging\IconFactory;
+use TYPO3\CMS\Core\Resource\AbstractFile;
 use TYPO3\CMS\Core\Resource\Folder;
 use TYPO3\CMS\Core\Resource\ProcessedFile;
 use TYPO3\CMS\Core\Resource\ResourceFactory;
@@ -358,6 +359,10 @@ class ElementInformationController
             if ($this->type === 'file') {
                 $extraFields['creation_date'] = $lang->sL('LLL:EXT:lang/locallang_general.xlf:LGL.creationDate', true);
                 $extraFields['modification_date'] = $lang->sL('LLL:EXT:lang/locallang_general.xlf:LGL.timestamp', true);
+                if ($this->fileObject->getType() === AbstractFile::FILETYPE_IMAGE) {
+                    $extraFields['width'] = htmlspecialchars($lang->sL('LLL:EXT:lang/locallang_general.xlf:LGL.width'));
+                    $extraFields['height'] = htmlspecialchars($lang->sL('LLL:EXT:lang/locallang_general.xlf:LGL.height'));
+                }
             }
             $extraFields['storage'] = $lang->sL('LLL:EXT:lang/locallang_tca.xlf:sys_file.storage', true);
             $extraFields['folder'] = $lang->sL('LLL:EXT:lang/locallang_common.xlf:folder', true);
@@ -384,8 +389,12 @@ class ElementInformationController
                     $rowValue = $resourceObject->getStorage()->getName();
                 } elseif ($name === 'folder') {
                     $rowValue = $resourceObject->getParentFolder()->getReadablePath();
+                } elseif ($name === 'width') {
+                    $rowValue = $this->fileObject->getProperty('width') . 'px';
+                } elseif ($name === 'height') {
+                    $rowValue = $this->fileObject->getProperty('height') . 'px';
                 }
-            } elseif (in_array($name, ['creation_date', 'modification_date'], true)) {
+            } elseif ($name === 'creation_date' || $name === 'modification_date') {
                 $rowValue = BackendUtility::datetime($this->row[$name]);
             } else {
                 $rowValue = BackendUtility::getProcessedValueExtra($this->table, $name, $this->row[$name]);
index adcc18c..86b061f 100644 (file)
                        <trans-unit id="LGL.image">
                                <source>Image:</source>
                        </trans-unit>
+                       <trans-unit id="LGL.width">
+                               <source>Width</source>
+                       </trans-unit>
+                       <trans-unit id="LGL.height">
+                               <source>Height</source>
+                       </trans-unit>
                        <trans-unit id="LGL.caption">
                                <source>Caption:</source>
                        </trans-unit>