Skip to main content

Prevent upscaling responsive images



  • Marissa Masangcay

    Hi Micah,

    Cloudinary supports conditional transformations for images where certain transformations are applied when a particular condition is met (or not met, depending on the logic). You can read more about and view examples of our conditional transformations in our documentation here:

    However, as an example of the situation that you gave, here is a URL that adjusts the width of the image depending on if the image's height is greater than or less than 500px:,h_600/if_h_gt_500,w_300/sample.jpg

    In this URL I first specified the height so that you can play around with the height values and see the differences when the height is less than or greater than 500px. When the height is greater than 500px it then transforms the image to have a width of 300px.

    Please feel free to play around with the width and height values to get a feel of how it works. :)

    Hope this helps!

  • Micah Kohne

    Wow - this is so powerful. Thanks for the help Marissa.


Post is closed for comments.