FluidTYPO3 / vhs

TYPO3 extension VHS: Fluid ViewHelpers
https://fluidtypo3.org
Other
188 stars 230 forks source link

AbstractImageViewHelper and umlauts #671

Closed wazum closed 10 years ago

wazum commented 10 years ago

hiya!

I uploaded a file named „A_töst_filenöme_makes_Å_troubles.png“ with

'SYS/UTF8filesystem' => '1', 'BE/forceCharset' => 'utf-8', 'SYS/systemLocale' => 'en_US.UTF-8'

which works without a problem (upload, FAL, Web > List module, frontend), only the vhs media.image helper makes problems.

I fixed it with the following changes (1. the Core's getImgResource/PHP's is_file does expect raw file names (not url encoded), 2. the processed filename was urlencoded twice then)

diff --git a/Classes/ViewHelpers/Media/Image/AbstractImageViewHelper.php b/Classes/ViewHelpers/Media/Image/AbstractImageViewHelper.php
index 343d08c..be457f8 100644
--- a/Classes/ViewHelpers/Media/Image/AbstractImageViewHelper.php
+++ b/Classes/ViewHelpers/Media/Image/AbstractImageViewHelper.php
@@ -131,14 +131,14 @@ abstract class AbstractImageViewHelper extends AbstractMediaViewHelper {
                if ('BE' === TYPO3_MODE && '../' === substr($src, 0, 3)) {
                        $src = substr($src, 3);
                }
-               $this->imageInfo = $this->contentObject->getImgResource($src, $setup);
+               $this->imageInfo = $this->contentObject->getImgResource(urldecode($src), $setup);
                $GLOBALS['TSFE']->lastImageInfo = $this->imageInfo;
                if (FALSE === is_array($this->imageInfo)) {
                        throw new Exception('Could not get image resource for "' . htmlspecialchars($src) . '".', 1253191060);
                }
                $this->imageInfo[3] = GeneralUtility::png_to_gif_by_imagemagick($this->imageInfo[3]);
                $GLOBALS['TSFE']->imagesOnPage[] = $this->imageInfo[3];
-               $this->mediaSource = $GLOBALS['TSFE']->absRefPrefix . GeneralUtility::rawUrlEncodeFP($this->imageInfo[3]);
+               $this->mediaSource = $GLOBALS['TSFE']->absRefPrefix . $this->imageInfo[3];
                if ('BE' === TYPO3_MODE) {
                        $this->resetFrontendEnvironment();
                }
NamelessCoder commented 10 years ago

If you're getting urlencoded values in this ViewHelper (which seems to be the entire cause of this problem) you are most likely passing an incorrect variable to the image ViewHelper as src argument, or there is a bug or unclear behavior in FAL / TYPO3 CMS itself, which for some reason sets urlencoded values. In any case, the fact that you require urldecode points to a problem not related to VHS.

If all else fails: src="{urlencodedSourceString -> v:format.url.decode()}".