Skip to content

Latest commit

 

History

History
12 lines (7 loc) · 719 Bytes

markup-filter-image-width.md

File metadata and controls

12 lines (7 loc) · 719 Bytes

|imageWidth

The |imageWidth filter attempts to identify the width in pixels of the provided image source.

NOTE: This filter does not support thumbnail (already resized) versions of FileModels being passed as the image source.

{% set resizedImage = 'banner.jpg'|media|resize(1920, 1080) %}
<img src="{{ resizedImage }}" width="{{ resizedImage|imageWidth }}" />

See the image resizer article for more information on what image sources are supported.

Note: The image resizing functionality requires a cache driver that persists cache data between requests in order to function, array is not a supported cache driver if you wish to use this functionality.