Skip to content
Snippets Groups Projects
Commit 0309e28a authored by Benni Mack's avatar Benni Mack
Browse files

[BUGFIX] Add max width for social media images

The og:image and twitter:image meta tags are not resized.
If an editor puts a 5000 pixel wide image in a field,
it does not get resized, and if it is large
enough (in size + MB) it doesn't get picked up everywhere.

For this reason, we'll limit the image width to 2000

Resolves: #91687
Releases: master, 10.4
Change-Id: Iec7b185c37b3685f523a0debebf90dbc7025bbc6
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64909


Tested-by: default avatarRichard Haeser <richard@maxserv.com>
Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: default avatarDavid Steeb <david.steeb@b13.com>
Tested-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarRichard Haeser <richard@maxserv.com>
Reviewed-by: default avatarDavid Steeb <david.steeb@b13.com>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
parent e5c3f707
Branches
Tags
No related merge requests found
...@@ -141,10 +141,9 @@ class MetaTagGenerator ...@@ -141,10 +141,9 @@ class MetaTagGenerator
$cropArea = $cropVariantCollection->getCropArea($cropVariant); $cropArea = $cropVariantCollection->getCropArea($cropVariant);
$crop = $cropArea->makeAbsoluteBasedOnFile($file); $crop = $cropArea->makeAbsoluteBasedOnFile($file);
$cropInformation = $crop->asArray();
$processingConfiguration = [ $processingConfiguration = [
'crop' => $crop 'crop' => $crop,
'maxWidth' => 2000
]; ];
$processedImage = $file->getOriginalFile()->process( $processedImage = $file->getOriginalFile()->process(
...@@ -156,8 +155,8 @@ class MetaTagGenerator ...@@ -156,8 +155,8 @@ class MetaTagGenerator
$socialImages[] = [ $socialImages[] = [
'url' => $imageUri, 'url' => $imageUri,
'width' => floor($cropInformation['width']), 'width' => floor($processedImage->getProperty('width')),
'height' => floor($cropInformation['height']), 'height' => floor($processedImage->getProperty('height')),
'alternative' => $arguments['alternative'], 'alternative' => $arguments['alternative'],
]; ];
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment