[BUGFIX] Add needed setting to handle file_references correctly
authorAnja Leichsenring <aleichsenring@ab-softlab.de>
Thu, 13 Dec 2012 15:31:35 +0000 (16:31 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Tue, 26 Mar 2013 22:07:16 +0000 (23:07 +0100)
The ImageViewHelper needs the setting 'treatIdAsReference' to
handle file_references correctly.

Change-Id: I4aa8ea8e50147a7f3b8d4b5695b6d37bd4ce501f
Fixes: #43964
Releases: 6.0, 6.1
Reviewed-on: https://review.typo3.org/17152
Reviewed-by: Sebastian Michaelsen
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
typo3/sysext/fluid/Classes/ViewHelpers/ImageViewHelper.php

index d8ba0b9..ecf7abf 100644 (file)
@@ -71,6 +71,7 @@ class ImageViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedV
 
        /**
         * @param \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager
 
        /**
         * @param \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager
+        *
         * @return void
         */
        public function injectConfigurationManager(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager) {
         * @return void
         */
        public function injectConfigurationManager(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager) {
@@ -96,6 +97,7 @@ class ImageViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedV
         * Resizes a given image (if required) and renders the respective img tag
         *
         * @see http://typo3.org/documentation/document-library/references/doc_core_tsref/4.2.0/view/1/5/#id4164427
         * Resizes a given image (if required) and renders the respective img tag
         *
         * @see http://typo3.org/documentation/document-library/references/doc_core_tsref/4.2.0/view/1/5/#id4164427
+        *
         * @param string $src
         * @param string $width width of the image. This can be a numeric value representing the fixed width of the image in pixels. But you can also perform simple calculations by adding "m" or "c" to the value. See imgResource.width for possible options.
         * @param string $height height of the image. This can be a numeric value representing the fixed height of the image in pixels. But you can also perform simple calculations by adding "m" or "c" to the value. See imgResource.width for possible options.
         * @param string $src
         * @param string $width width of the image. This can be a numeric value representing the fixed width of the image in pixels. But you can also perform simple calculations by adding "m" or "c" to the value. See imgResource.width for possible options.
         * @param string $height height of the image. This can be a numeric value representing the fixed height of the image in pixels. But you can also perform simple calculations by adding "m" or "c" to the value. See imgResource.width for possible options.
@@ -103,10 +105,12 @@ class ImageViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedV
         * @param integer $minHeight minimum height of the image
         * @param integer $maxWidth maximum width of the image
         * @param integer $maxHeight maximum height of the image
         * @param integer $minHeight minimum height of the image
         * @param integer $maxWidth maximum width of the image
         * @param integer $maxHeight maximum height of the image
+        * @param boolean $treatIdAsReference given src argument is a sys_file_reference record
+        *
         * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception
         * @return string rendered tag.
         */
         * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception
         * @return string rendered tag.
         */
-       public function render($src, $width = NULL, $height = NULL, $minWidth = NULL, $minHeight = NULL, $maxWidth = NULL, $maxHeight = NULL) {
+       public function render($src, $width = NULL, $height = NULL, $minWidth = NULL, $minHeight = NULL, $maxWidth = NULL, $maxHeight = NULL, $treatIdAsReference = FALSE) {
                if (TYPO3_MODE === 'BE') {
                        $this->simulateFrontendEnvironment();
                }
                if (TYPO3_MODE === 'BE') {
                        $this->simulateFrontendEnvironment();
                }
@@ -116,7 +120,8 @@ class ImageViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedV
                        'minW' => $minWidth,
                        'minH' => $minHeight,
                        'maxW' => $maxWidth,
                        'minW' => $minWidth,
                        'minH' => $minHeight,
                        'maxW' => $maxWidth,
-                       'maxH' => $maxHeight
+                       'maxH' => $maxHeight,
+                       'treatIdAsReference' => $treatIdAsReference
                );
                if (TYPO3_MODE === 'BE' && substr($src, 0, 3) === '../') {
                        $src = substr($src, 3);
                );
                if (TYPO3_MODE === 'BE' && substr($src, 0, 3) === '../') {
                        $src = substr($src, 3);