How to get filename image's extensions
Archive
I use loop:
{% for filename, image in page.media.images %}
And I want to retrieve a image's filename extension, how can I do that?
Figured it out by myself:
{% set filename_ext = filename|split('.') %}
then:
{{ filename_ext[1] }}
Actually there's a better way:
TWIG
{{ image.extension }}
Log in to reply.
Suggested topics
| Topic | Participants | Replies | Views | Activity |
|---|---|---|---|---|
| 0 | 1355 | 9 years ago | ||
| 2 | 935 | 9 years ago | ||
| 2 | 4065 | 9 years ago | ||
| 1 | 2953 | 9 years ago | ||
| 3 | 1119 | 9 years ago |