Use constant from SettingsController in image renderer

[MAILPOET-5788]
This commit is contained in:
Jan Lysý
2024-01-16 09:53:14 +01:00
committed by Rostislav Wolný
parent 932f47b763
commit 1030d521c0

View File

@@ -44,7 +44,7 @@ class Image implements BlockRenderer {
*/
private function addImageSizeWhenMissing(array $parsedBlock, string $imageUrl): array {
if (!isset($parsedBlock['attrs']['width'])) {
$maxWidth = $parsedBlock['email_attrs']['width'] ?? '660px';
$maxWidth = $parsedBlock['email_attrs']['width'] ?? SettingsController::EMAIL_WIDTH;
$imageSize = wp_getimagesize($imageUrl);
$imageSize = $imageSize ? "{$imageSize[0]}px" : $maxWidth;
$parsedBlock['attrs']['width'] = ($imageSize > $maxWidth) ? $maxWidth : $imageSize;