-1

I'm not sure if this website is re-sizing images via HTML, or if the image size is automatically added to the code.

If the images are being re-sized, this would need to be fixed, because it slows page load times.

Here is an example page.

Muhammad Reda
  • 26,379
  • 14
  • 93
  • 105
trex14
  • 58
  • 7

1 Answers1

1

You will need to override default theme_image and remove width and height properties, or set their values to auto.

Example:

// In your theme's template.php file
function [YOUR_THEME]_image($variables) {
  $attributes = $variables['attributes'];
  $attributes['src'] = file_create_url($variables['path']);

  foreach (array('alt', 'title') as $key) {
    if (isset($variables[$key])) {
      $attributes[$key] = $variables[$key];
    }
  }

  return '<img' . drupal_attributes($attributes) . ' />';
}
Muhammad Reda
  • 26,379
  • 14
  • 93
  • 105
  • Ok, so you're saying that there is re-sizing happening via html? – trex14 Aug 12 '14 at 19:24
  • No, it's not what I'm saying :). You asked `How to Remove Image Resizing in HTML`, and the answer explains how. But in order to create image style presets, you should do that from `?q=admin/config/media/image-styles`. – Muhammad Reda Aug 13 '14 at 07:22