[BUGFIX] IMG_RESOURCE does not prepend absRefPrefix 02/43002/4
authorHeiko Kromm <h.kromm@paints.de>
Thu, 3 Sep 2015 19:27:13 +0000 (21:27 +0200)
committerHelmut Hummel <helmut.hummel@typo3.org>
Wed, 9 Sep 2015 22:36:00 +0000 (00:36 +0200)
Rendering an imageResource with TypoScript IMG_RESOURCE
does not prepend the absRefPrefix.
This will cause problems loading images when not using config.baseUrl.
If it is not an absolute url we prepend absRefPrefix.

Resolves: #69516
Releases: master, 6.2
Change-Id: Icfca8bfe50cb5e1816cf73783a09d065d299521a
Reviewed-on: http://review.typo3.org/43002
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
Tested-by: Helmut Hummel <helmut.hummel@typo3.org>
typo3/sysext/frontend/Classes/ContentObject/ImageResourceContentObject.php

index 7137935..dca9a0d 100644 (file)
@@ -28,7 +28,11 @@ class ImageResourceContentObject extends AbstractContentObject {
        public function render($conf = array()) {
                $GLOBALS['TSFE']->lastImgResourceInfo = $this->cObj->getImgResource($conf['file'], $conf['file.']);
                if ($GLOBALS['TSFE']->lastImgResourceInfo) {
-                       $imageResource = $GLOBALS['TSFE']->lastImgResourceInfo[3];
+                       $urlPrefix = '';
+                       if (parse_url($GLOBALS['TSFE']->lastImgResourceInfo[3], PHP_URL_HOST) === NULL) {
+                               $urlPrefix = $GLOBALS['TSFE']->absRefPrefix;
+                       }
+                       $imageResource = $urlPrefix . $GLOBALS['TSFE']->lastImgResourceInfo[3];
                        $theValue = isset($conf['stdWrap.']) ? $this->cObj->stdWrap($imageResource, $conf['stdWrap.']) : $imageResource;
                } else {
                        $theValue = '';