image-style-preview.html.twig

Same filename in this branch
  1. 11.x core/modules/image/templates/image-style-preview.html.twig
Same filename in other branches
  1. 9 core/themes/stable9/templates/admin/image-style-preview.html.twig
  2. 9 core/themes/stable/templates/admin/image-style-preview.html.twig
  3. 9 core/modules/image/templates/image-style-preview.html.twig
  4. 8.9.x core/themes/stable/templates/admin/image-style-preview.html.twig
  5. 8.9.x core/modules/image/templates/image-style-preview.html.twig
  6. 10 core/themes/stable9/templates/admin/image-style-preview.html.twig
  7. 10 core/modules/image/templates/image-style-preview.html.twig

Theme override to display a preview of an image style.

Available variables:

  • style_id: The ID of the image style.
  • style_name: The name of the image style.
  • cache_bypass: A timestamp token used to avoid browser caching of images.
  • original: An associative array containing:
    • url: The URL of the original image.
    • width: The width in pixels of the original image.
    • height: The height in pixels of the original image.
    • rendered: The render array for the original image.
  • derivative: An associative array containing:
    • url: The URL of the derivative image.
    • width: The width in pixels of the derivative image.
    • height: The height in pixels of the derivative image.
    • rendered: The rendered derivative image.
  • preview: An associative array containing:
    • original: An associative array containing:

      • width: The width in pixels of the original image in the preview.
      • height: The height in pixels of the original image in the preview.
    • derivative: An associative array containing:
      • width: The width in pixels of the derivative image in the preview.
      • height: The height in pixels of the derivative image in the preview.

See also

template_preprocess_image_style_preview()

1 theme call to image-style-preview.html.twig
ImageStyleEditForm::form in core/modules/image/src/Form/ImageStyleEditForm.php
Gets the actual form array to be built.

File

core/themes/stable9/templates/admin/image-style-preview.html.twig

View source
  1. {#
  2. /**
  3. * @file
  4. * Theme override to display a preview of an image style.
  5. *
  6. * Available variables:
  7. * - style_id: The ID of the image style.
  8. * - style_name: The name of the image style.
  9. * - cache_bypass: A timestamp token used to avoid browser caching of images.
  10. * - original: An associative array containing:
  11. * - url: The URL of the original image.
  12. * - width: The width in pixels of the original image.
  13. * - height: The height in pixels of the original image.
  14. * - rendered: The render array for the original image.
  15. * - derivative: An associative array containing:
  16. * - url: The URL of the derivative image.
  17. * - width: The width in pixels of the derivative image.
  18. * - height: The height in pixels of the derivative image.
  19. * - rendered: The rendered derivative image.
  20. * - preview: An associative array containing:
  21. * - original: An associative array containing:
  22. * - width: The width in pixels of the original image in the preview.
  23. * - height: The height in pixels of the original image in the preview.
  24. * - derivative: An associative array containing:
  25. * - width: The width in pixels of the derivative image in the preview.
  26. * - height: The height in pixels of the derivative image in the preview.
  27. *
  28. * @see template_preprocess_image_style_preview()
  29. */
  30. #}
  31. <div class="image-style-preview preview clearfix">
  32. {# Preview of the original image. #}
  33. <div class="preview-image-wrapper">
  34. {{ 'original'|t }} (<a href="{{ original.url }}">{{ 'view actual size'|t }}</a>)
  35. <div class="preview-image original-image" style="width: {{ preview.original.width }}px; height: {{ preview.original.height }}px;">
  36. <a href="{{ original.url }}">
  37. {{ original.rendered }}
  38. </a>
  39. <div class="height" style="height: {{ preview.original.height }}px"><span>{{ original.height }}px</span></div>
  40. <div class="width" style="width: {{ preview.original.width }}px"><span>{{ original.width }}px</span></div>
  41. </div>
  42. </div>
  43. {# Derivative of the image style. #}
  44. <div class="preview-image-wrapper">
  45. {{ style_name }} (<a href="{{ derivative.url }}?{{ cache_bypass }}">{{ 'view actual size'|t }}</a>)
  46. <div class="preview-image modified-image" style="width: {{ preview.derivative.width }}px; height: {{ preview.derivative.height }}px;">
  47. <a href="{{ derivative.url }}?{{ cache_bypass }}">
  48. {{ derivative.rendered }}
  49. </a>
  50. <div class="height" style="height: {{ preview.derivative.height }}px"><span>{{ derivative.height }}px</span></div>
  51. <div class="width" style="width: {{ preview.derivative.width }}px"><span>{{ derivative.width }}px</span></div>
  52. </div>
  53. </div>
  54. </div>

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.