2

At the moment I have an image 300px wide, my transform is set to a width of 600px so it upscales it.

I would like it to only transform if the image is over 600px.

Is this possible or should I use some other image manipulation thing like phpthumb?

0

1 Answer 1

4

You can easily do this in twig with a conditional that checks if the width of the image is larger than your target transforms width. Try something like this:

{% if image.getWidth()>600 %}
  <img src="{{ image.getUrl({ width: 600 }) }}">
{% else %}
  <img src="{{ image.getUrl() }}">
{% endif %}

Not the answer you're looking for? Browse other questions tagged or ask your own question.