Pass aspect ratio as variable into imager I use imager to transform images and I want to pass the image ratio as a variable:

{% set customRatio = 1/1 %}

{% set image = craft.assets().one() %}
{% set transformedImage = craft.imager.transformImage(image,
    { width: 1000, ratio: customRatio })
 %}
 &lt;img src="{{ transformedImage.url }}"&gt;


This does not work. There is something wrong with how it is passed along. If I pass it as a string: {% set customRatio = '1/1' %}. It doesn't work either. (No errors in both cases).

But when I write it directely into the imager markup like this:

{% set image = craft.assets().one() %}
{% set transformedImage = craft.imager.transformImage(image,
    { width: 1000, ratio: 1/1 })
 %}
 &lt;img src="{{ transformedImage.url }}"&gt;


Then it works. But why?
Your variable assignment is wrong. {% set customRatio == 1/1 %} should be {% set customRatio = 1/1 %}.