Closed MrGlasspoole closed 5 years ago
Ok i got it. I can do:
{% set imageSizes = [{ width: 800}, { width: 640}, { width: 480}, { width: 320}, { width: 160}] %}
{% set transformedImages = craft.imager.transformImage(image, imageSizes %}
Inside twig tags, you always just use variables in the twig context directly, you never use twig in twig, so:
{% set transformedImages = craft.imager.transformImage(image,
[
{ width: myWidth, jpegQuality: 90 }
],
{
format: myFormat,
}
) %}
If these are fields on an entry
variable, you'd do entry.myWidthField
.
Refer to the Twig and Craft documentation for more information on this.
How can i set parameters like width, height, format and so on from a field? Everything i tried did not work.
Like:
In Expression Engine i was using CE Image and did things like that:
<a href="{produkte_ma_text_bild}">{exp:ce_img:make src="{produkte_ma_text_bild}" max_height="{produkte_ma_text_bild_height}"}<img class="proimg" src="{made}" alt="{title}" title="{title}" width="{width}" height="{height}" />{/exp:ce_img:make}</a>
If you write an article with images they are all of different sizes...