Issue Bug Closed

#86950styles.content.textmedia.maxW TypoScript constant not valid for Youtube videos

Sergio Catalá 11/20/18, 09:47 updated 11/08/26, 19:39

Description

Using TYPO3 8.7 core.

It seems TypoScript constant styles.content.mediatext.maxW is respected for Text+Media content elements that attach images, but not for Youtube videos. A large image is scaled to that maximum width. However, a Youtube video has always maximum width 480px for the frame, even if you set the maximum width larger. Has anyone experienced this issue?

I tested it over TYPO3 9.5 and 8.7 cores.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 17

  1. Sergio Catalá changed subject maxWInText TypoScript setting not valid for Youtube videos styles.content.textmedia.maxW TypoScript constant not valid for Youtube videos <span data-processor="relativetime" data-value="2018-11-30T16:24:38+00:00" > 11/30/18, 16:24 </span>

  2. Riccardo De Contardi commented <span data-processor="relativetime" data-value="2019-01-12T19:32:37+00:00" > 01/12/19, 19:32 </span>

    I performed tests on TYPO3 8.7.22, 9.5.3 and latest master

    My tests:

    Test 1

    1) put on TS Constants:

    styles.content.textmedia.maxW = 300
    styles.content.textmedia.maxWInText = 150

    2) Create a CE Text and Media
    3) put in it a “media by URL (e.g. https://www.youtube.com/watch?v=HmZKgaHa3Fg)
    4) set Number of Columns = 1

    Results

    On both the cases:
    - Position and Alignment: Above,center [0]
    - Position and Alignment: Intext, Left [18]

    the video box is resized to the dimensions specified in the constants.

    Test 2

    1) put on TS Constants:

    styles.content.textmedia.maxW = 600
    styles.content.textmedia.maxWInText = 600

    2) Create a CE Text and Media
    3) put in it a “media by URL (e.g. https://www.youtube.com/watch?v=HmZKgaHa3Fg)
    4) set Number of Columns = 1

    Results

    On both the cases:
    - Position and Alignment: Above,center [0]
    - Position and Alignment: Intext, Left [18]

    The video is resized with a width= 480px

    Test 3

    Same as test 2, but I set Width of each element (px) = 900px

    Results:

    Now the video box is resized to the dimensions specified in the constants.

    It seems that 480px is a kind of “standard” dimension that is set if no width is specified on the media element field (imagewidth).

  3. Sergio Catalá commented <span data-processor="relativetime" data-value="2019-01-18T16:10:22+00:00" > 01/18/19, 16:10 </span>

    I have the same results as you, Riccardo, except test 3.
    I think you made a mistake there with the test?
    Even if setup the constant as 900, the youtube video width is still 480px.

    So that’s a TYPO3 bug, or being a standard, we cannot keep the width larger?

  4. Riccardo De Contardi commented <span data-processor="relativetime" data-value="2019-01-18T16:22:38+00:00" > 01/18/19, 16:22 </span>

    @Sergio I repeated my last test on a different TYPO3 installation, brand new.

    TS Constants:

    styles.content.textmedia.maxW = 600
    styles.content.textmedia.maxWInText = 600

    - Add media element
    - Add media by URL (e.g. https://www.youtube.com/watch?v=4voI_kMl8gs)
    - [imagewidth] = 900px
    - [imageorient] = above, Center (18)

    Maybe I explained myself badly: 900px is a value set in the content element created (Media Adjustments >
    Width of each element (px)[imagewidth])

    Results:

    The video box is resized with a width of 600px

    About the “magic” 480px value I don’t know… I was not able to find where it comes from so far.

  5. Sergio Catalá commented <span data-processor="relativetime" data-value="2019-01-18T17:30:29+00:00" > 01/18/19, 17:30 </span>

    Ok, I misunderstood.
    I never do my tests setting up the width over the content element. I only change the TypoScript constant.
    This is precisely what I’m interested in: where this 480px comes from. It seems that if we setup the constant larger than ‘480’, it doesn’t take any effect.

  6. Riccardo De Contardi commented <span data-processor="relativetime" data-value="2019-01-21T22:59:38+00:00" > 01/21/19, 22:59 </span>

    As far as I have seen, the dimensions 480×270 (which are the default dimensions for youtube videos) are written in the database sys_file_metadata table when you create a youtube record.

  7. Sergio Catalá commented <span data-processor="relativetime" data-value="2019-02-05T14:20:07+00:00" > 02/05/19, 14:20 </span>

    And is that ok, Riccardo? Or a bug from core?
    As far as I can see, dimensions cannot be changed inside metadata of .youtube file through Filelist module in BE.

  8. Alexander Vogt commented <span data-processor="relativetime" data-value="2020-02-06T15:56:53+00:00" > 02/06/20, 15:56 </span>

    This issue occurs because of the youtube default dimensions in sys_file_metadata. The dimesions are fetched through the youtube oEmbed api (e.g. https://www.youtube.com/oembed?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DIy3AoaEQoyQ&format=json). This api always returns a width of 480px and a height of 270px. So the sys_file_metadata record of a youtube sys_file has always this dimensions.

    Online media metadata extractor:
    https://github.com/TYPO3/TYPO3.CMS/blob/v9.5.13/typo3/sysext/core/Classes/Resource/OnlineMedia/Metadata/Extractor.php#L87-L92

    YouTube helper oembed api call:
    https://github.com/TYPO3/TYPO3.CMS/blob/v9.5.13/typo3/sysext/core/Classes/Resource/OnlineMedia/Helpers/YouTubeHelper.php#L100-L107

    The rendering of a textmedia content element is based on the sys_file_metadata dimensions. The GalleryProcessor will never calculate bigger dimensions than 480×270px.

    GalleryProcessor (used for textmedia content rendering):
    https://github.com/TYPO3/TYPO3.CMS/blob/v9.5.13/typo3/sysext/frontend/Classes/DataProcessing/GalleryProcessor.php#L453

  9. Michael Sollmann commented <span data-processor="relativetime" data-value="2021-09-16T14:37:11+00:00" > 09/16/21, 14:37 </span>

    Can confirm this with TYPO3 10. The dimensions of a video should not be fetched or should be editable in the BE.

  10. Benni Mack commented and changed status New Closed <span data-processor="relativetime" data-value="2026-11-08T19:39:48+00:00" > 11/08/26, 19:39 </span>

    Fixed by #97481 (570dd7436ef, released for 10.4/11.5/main): the YouTube oEmbed request now passes maxwidth=2048&maxheight=2048, so the dimensions stored in sys_file_metadata are no longer capped at YouTube’s small default size, and styles.content.textmedia.maxW takes effect. Files added before that fix keep their old dimensions until their metadata is extracted again. Closing as resolved.