I try this method to get image dimensions:
{% set image_width = fields.sec_port_image.width %}
{% set image_height = fields.sec_port_image.height %}
<a href="{{ fields.sec_port_image|media }}" width="{{ image_width }}" height="{{ image_height }}">
but without success. I Also tried:
{% set image_width = fields.sec_port_image.width|media %}
and
{% set image_width = fields.sec_port_image|media.width %}
but also without success.
Is there a way on Octobercms to get image dimensions using twig?
Extend
twig
in order to get the original size of your image. Something like this should work (not tested but you'll get the idea)First create a registration class, see here for a reference.
If done correctly you then could use the new filters inside your template like this