i have images with 2000 * 700 pixel and i have to render those images in two different places one with original diminution while the second is with 100 * 60 pixel so each time i have to load the full size for the image which cause a performance issue, how i can render a different image size (do image resizing) according to my UI design

we tried a lot of modules but since its a physical path we could not find a solution .


  • Please edit your question to include Drupal version and how you provide the images. If you have used a Drupal image field, you can use image styles to create scaled derivative images. Have you tried that? Why didn't it work for your case? – Neograph734 Jul 26 '17 at 11:39
  • 1
    Thanks a for your replay, i'll check it and i'll get back to you – MasterMaster01 Jul 26 '17 at 11:45

You don't need a third-party module for this. Assuming the image is part of the content, Drupal comes with Image Styles which allows you to alter on-the-fly how an image is rendered. See the Adding and Changing Styles section of the linked document for more details.

In summary, go to Administration > Configuration > Media > Image styles. Then you define a style. You'll most likely need the "scale" effect for this. Set width to 100 and leave height blank to preserve the ratio. Then save. Then on whatever you are using to configure rendering of content (manage display, panels, views, etc.), set the formatter of the image to render the image, and to use the style you just defined (by default, this is the setting with the Original value).

If you mean to do this programmatically, you can call the style directly using theme. See this answer for more details on how to do that.

Under the hood, Drupal will take the image, resize it using whatever toolkit is configured (by default it's GD) to whatever the image style defined. It does not alter the original image, but creates a copy. A quick way to know if this is working is if you inspect the image and see that the url has the name of the image style.

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.