[BUGFIX] ColorPicker: Use absolute web path for exampleImg 40/45140/2
authorBenni Mack <benni@typo3.org>
Sat, 5 Dec 2015 12:58:19 +0000 (13:58 +0100)
committerMorton Jonuschat <m.jonuschat@mojocode.de>
Sun, 6 Dec 2015 12:13:08 +0000 (13:13 +0100)
The Example Image of the color picker is currently hardcoded (also with ..)
to the typo3/ directory.
This hinders integrators to allow any other file outside of typo3/ to be shown.

The patch corrects the path resolving part of the Color Picker.

Resolves: #70428
Releases: master
Change-Id: I2fb5a6b7379ee1cb5fd6e76d8081f2f72f91a098
Reviewed-on: https://review.typo3.org/45140
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
typo3/sysext/backend/Classes/Controller/Wizard/ColorpickerController.php

index 163d2e2..f2df83a 100644 (file)
@@ -20,6 +20,7 @@ use TYPO3\CMS\Backend\Template\DocumentTemplate;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\PathUtility;
 
 /**
  * Script Class for colorpicker wizard
@@ -148,9 +149,9 @@ class ColorpickerController extends AbstractWizardController
         // Resolving image (checking existence etc.)
         $this->imageError = '';
         if ($this->exampleImg) {
-            $this->pickerImage = GeneralUtility::getFileAbsFileName($this->exampleImg, 1, 1);
+            $this->pickerImage = GeneralUtility::getFileAbsFileName($this->exampleImg);
             if (!$this->pickerImage || !@is_file($this->pickerImage)) {
-                $this->imageError = 'ERROR: The image, "' . $this->exampleImg . '", could not be found!';
+                $this->imageError = 'ERROR: The image "' . $this->exampleImg . '" could not be found!';
             }
         }
         $update = array();
@@ -375,7 +376,7 @@ class ColorpickerController extends AbstractWizardController
                 }
                 $pickerFormImage = '
                                <p class="c-head">' . $this->getLanguageService()->getLL('colorpicker_fromImage', true) . '</p>
-                               <input type="image" src="../' . \TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix($this->pickerImage) . '" name="coords" style="cursor:crosshair;" /><br />';
+                               <input type="image" src="' . PathUtility::getAbsoluteWebPath($this->pickerImage) . '" name="coords" style="cursor:crosshair;" /><br />';
             } else {
                 $pickerFormImage = '';
             }