Issue Bug Closed

#104559Enlarge on Click [image_zoom] with ".gif" files results in FileReference could not be converted to string

Christian Hackl 08/06/24, 14:59 updated 02/07/26, 09:40

Description

Enlarge on Click [image_zoom] with “.gif” files results in FileReference could not be converted to string.

For example use TextMedia contentelement add a “.gif” file and set Enlarge on Click – so that the “ce:link.clickEnlarge” ViewHelper is used (fluid_styled_content/Resources/Private/Partials/Media/Type/Image.html).

Then at the Frontend the Error occures:
“Object of class TYPO3\CMS\Core\Resource\FileReference could not be converted to string.“
Only on GIF files – svg, jpg, jpeg, mp4, png works fine.

The TYPO3\CMS\Frontend\Typolink\LinkFactory->create() Method is called two times, one time empty “$linkConfiguration” and one time with values (array), see screenshoots.

Reviews 2

Files 5

History 67

  1. Georg Ringer commented and changed attached Bildschirmfoto 2025-01-31 um 12.48.08.png status New Needs Feedback <span data-processor="relativetime" data-value="2025-01-31T11:48:58+00:00" > 01/31/25, 11:48 </span>

    tested that in a blank 12 & 13 installation and didn’t have any issues

    see screenshot
    Bildschirmfoto%202025-01-31%20um%2012.48.08.png

    can you please retest on a blank latest installation?

  2. Sascha Löffler commented and changed attached enlargeOnClickCorePatch.patch <span data-processor="relativetime" data-value="2025-03-13T13:49:29+00:00" > 03/13/25, 13:49 </span>

    Got the same error, but with jpeg images on TYPO3 v13.
    It seems it happens because the url in the ContentObjectRenderer is overwritten with the initial FileReference at this location:

                $directImageLink = $this->stdWrapValue('directImageLink', $conf ?? []);
                if ($directImageLink) {
                    $imgResourceConf = [
                        'file' => $imageFile,
                        'file.' => $conf,
                    ];
                    $url = $this->cObjGetSingle('IMG_RESOURCE', $imgResourceConf);
                    if (!$url) {
                        // If no imagemagick / gm is available
                        $url = $imageFile;
                    }
                }

    Then with disabled JSwindow, it sets $conf[‘linkParams.’][‘parameter’] to $url

    At this point we have the FileReference at a place where it normally expects an ID since in the LinkFactory we got

    $linkParameter = trim((string)($linkConfiguration['parameter'] ?? ''));

    I attached a patch which seems to work (for TYPO3 v13).

  3. Gerrit Code Review pushed patch set 1 for main to change 88847 status Needs Feedback Under Review <span data-processor="relativetime" data-value="2025-03-31T12:16:10+00:00" > 03/31/25, 12:16 </span>

  4. Georg Ringer commented and changed status Under Review Closed <span data-processor="relativetime" data-value="2026-02-07T09:40:39+00:00" > 02/07/26, 09:40 </span>

    couldn’t reproduce that in v13 and also lack of feedback, closing issue.

    feel free to contact me on slack if still valid