diff --git a/core/modules/image/image.admin.inc b/core/modules/image/image.admin.inc index 80125f6..8bc68b0 100644 --- a/core/modules/image/image.admin.inc +++ b/core/modules/image/image.admin.inc @@ -139,7 +139,10 @@ function template_preprocess_image_style_preview(&$variables) { '#uri' => $original_path, '#alt' => t('Sample original image'), '#title' => '', - '#attributes' => $variables['original'], + '#attributes' => array( + 'width' => $variables['original']['width'], + 'height' => $variables['original']['height'], + ), ); // In the preview, timestamps are added to prevent caching of images. @@ -149,7 +152,10 @@ function template_preprocess_image_style_preview(&$variables) { '#uri' => $variables['derivative']['url'] . '?cache_bypass=' . $variables['cache_bypass'], '#alt' => t('Sample modified image'), '#title' => '', - '#attributes' => $variables['derivative'], + '#attributes' => array( + 'width' => $variables['derivative']['width'], + 'height' => $variables['derivative']['height'], + ), ); } diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageDimensionsTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageDimensionsTest.php index 76c80c2..4a67167 100644 --- a/core/modules/image/lib/Drupal/image/Tests/ImageDimensionsTest.php +++ b/core/modules/image/lib/Drupal/image/Tests/ImageDimensionsTest.php @@ -240,7 +240,7 @@ function testImageDimensions() { * re-rendered each time. */ protected function getImageTag($variables) { - return drupal_render($variables); + return str_replace("\n", NULL, drupal_render($variables)); } } diff --git a/core/modules/image/templates/image-crop-summary.html.twig b/core/modules/image/templates/image-crop-summary.html.twig index e076520..cfee8af 100644 --- a/core/modules/image/templates/image-crop-summary.html.twig +++ b/core/modules/image/templates/image-crop-summary.html.twig @@ -17,16 +17,11 @@ * @ingroup themeable */ #} -{% if data.width and data.height %} - {{ data.width|e }}x{{ data.height|e }} +{% if data.width and data.height %}{{ data.width|e }}x{{ data.height|e }} {% else %} {% if data.width %} - {% trans %} - width {{ data.width|e }} - {% endtrans %} + {% trans %}width {{ data.width|e }}{% endtrans %} {% elseif data.height %} - {% trans %} - height {{ data.height|e }} - {% endtrans %} + {% trans %}height {{ data.height|e }}{% endtrans %} {% endif %} {% endif %} diff --git a/core/modules/image/templates/image-resize-summary.html.twig b/core/modules/image/templates/image-resize-summary.html.twig index c490342..6f8b21e 100644 --- a/core/modules/image/templates/image-resize-summary.html.twig +++ b/core/modules/image/templates/image-resize-summary.html.twig @@ -15,16 +15,11 @@ * @ingroup themeable */ #} -{% if data.width and data.height %} - {{ data.width|e }}x{{ data.height|e }} +{% if data.width and data.height %}{{ data.width|e }}x{{ data.height|e }} {% else %} {% if data.width %} - {% trans %} - width {{ data.width|e }} - {% endtrans %} + {% trans %}width {{ data.width|e }}{% endtrans %} {% elseif data.height %} - {% trans %} - height {{ data.height|e }} - {% endtrans %} + {% trans %}height {{ data.height|e }}{% endtrans %} {% endif %} {% endif %} diff --git a/core/modules/image/templates/image-scale-summary.html.twig b/core/modules/image/templates/image-scale-summary.html.twig index dbbc9af..d5936c4 100644 --- a/core/modules/image/templates/image-scale-summary.html.twig +++ b/core/modules/image/templates/image-scale-summary.html.twig @@ -16,17 +16,12 @@ * @ingroup themeable */ #} -{% if data.width and data.height %} - {{ data.width|e }}x{{ data.height|e }} +{% if data.width and data.height %}{{ data.width|e }}x{{ data.height|e }} {% else %} {% if data.width %} - {% trans %} - width {{ data.width|e }} - {% endtrans %} + {% trans %}width {{ data.width|e }}{% endtrans %} {% elseif data.height %} - {% trans %} - height {{ data.height|e }} - {% endtrans %} + {% trans %}height {{ data.height|e }}{% endtrans %} {% endif %} {% endif %}