I created a view with...
format: grid
image style: medium

This works great in responsive layouts because the images scale. No height or width dimensions were generated.

When I create a custom image style that creates square images by a scale and crop, it forces the height and width info.

This obviously squishes the images in narrow layouts.

How can I remove the generated height and width values?

Comments

hoavnd’s picture

This module https://drupal.org/project/adaptive_image is very helpful for responsive layout.

finedesign’s picture

Thanks. I'm familiar with that module but I'm trying to avoid installing additional contrib modules since the site is already pushing the server performance. It seems this should be a simple thing to do. If the default image formats can scale, certainly the custom ones I make can scale too.

laryn’s picture

In your template.php, this might help:

function [themename]_preprocess_image(&$variables) {
  $attributes = &$variables['attributes'];

  foreach (array('width', 'height') as $key) {
    unset($attributes[$key]);
    unset($variables[$key]);
  }
}

I didn't write it but picked it up in a comment somewhere on the intertubes.