Search code examples
cssimagedrupal-7

Drupal - Image resize


In my custom module I am using below code to display image. Image style "user_profile_image" having values 50, 50.

It is giving me html like this .

I don't want to resize image using height="50" width="50" in browser.

Can I resize it on server so that there is no need of height and width attributes at client side.

print theme('image_style', array('path' => $res_value->_field_data['users_node_uid']['entity']->picture->uri, 'style_name' => 'user_profile_image'));

Solution

  • Image style automatically applies your style (scale,scale and crop..) to images and store it under separate folder in drupal files location . Its not HTML resized images as you think . To verify this delete height and width attributes , you can find no changes in display.

    And image url contains styles/<image-style-name>

    For example: http://dummydomain.com/styles/thumbnail/testimg.jpg