I'm looking for a way to do a simple math operation on a variable before using it in a tag. Specifically, I'd like to generate a glide image url with a height based on a provided width, when given an aspect ratio. Glide doesn't appear to support an aspect ratio parameter, so I tried using a multiply modifier inside the tag.

I tried a few variations, but thought something like this would work:

{{ glide:image width="{w}" height="{w | multiply:2 }" }}

Doing it the following way output w in the height parameter, but didn't multiply it:

{{ glide:image width="{w}" height={w | multiply:2} }}

so either something is broken or I don't understand what's happening here (more likely).

Anyone have any idea what's going on here? Is the only option to create an addon to manage this calculation?

Answered by Erin Dalzell! Go to answer.