I need to scale image in Drupal 7. IF the width is greater than the height, THEN scale the image to 200px height. IF the height is greater than the width, THEN scale the image to 200px width. and if the width and height are the same, scale to 200x200. Please help me out.

  • 1
    height is you preference or width or you would like exactly 200x200 ? – vgoradiya Mar 28 '16 at 10:30
  • At-least 200x200. If width is greater then height then need to scale width, same vice-versa for height. – Alok Jain Mar 28 '16 at 11:19

I believe this module will do the trick:

ImageCache Actions

Effects provided


  • Aspect Switcher - lets you perform different actions or use different dimensions based on whether the image is 'landscape' or 'portrait'

You can use Image style Configuration » Media » Image styles. Add new image style and add scale property to it. Apply that image style to image field.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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