my goal was to add height and width attributes to images. But I initially thought of getting them from the images themselves, using:
{{ image.width }}
then, I realized that if I add, as you suggested to me:
image.height (). width ()
by entering arbitrary values, I get the same result I was looking for.
after this, I decided not to use derivatives anymore, because the compression of grav is not the most effective, and because I couldn't configure it well.
Why couldn't I? Because, as discussed in the other thread, I get a correct result for the images of the same page, however, for the images in the cards, which take images from other pages, connected to the page I am working on, these are not scaled. Therefore, I decided to use a simple resize, and the height and width attributes are consistent at this point.
Now I use this code for images in the cards carousel:
<div class="owl-carousel owl-theme">
{% for post in taxonomy.findTaxonomy({'tag':'optionals','model':page.taxonomy.model}).order('date', 'desc') %}
<div class="card">
{% set image = post.media.images|first %}
{% if image %}
<div class="card-image">
<a href="{{ post.url }}" title="{{ post.title }}">
{{ image.height(160).width(160).resize(160, 160).html(page.parent.title, post.title, 'img-full-responsive') }}
</a>
</div>
{% endif %}
<div class="card-footer">
<div class="tile tile-centered">
<div class="tile-icon">
<a href="{{ post.url }}" class="btn btn-primary" title="{{ post.title }}"><i class="icon icon-arrow-right"></i></a>
</div>
<div class="tile-content">
<div class="tile-title"> {{ post.title }}</div>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
and all seems ok.