With Drupal 6, if I used imagecache and insert, I could insert images using preset small-image (scale to 200px), medium-image (scale to 350px), etc. Then, if I wished to make small-image 203px because that fits better with my theme, all the images set to small-image would resize. Perfect.
In Drupal 7, when I click on insert using preset small_image, the image gets full attributes - such as alt, title, width 200px, height 175px, etc.
BUT, if I decide that I want small images to be 180px (for example), when I change the preset to scale to 180px, the inserted images stay at the original size of 200px X 175px (for example) and become pixelated (especially if I increase the size) and I have to delete the dimensions part of the <img> if I want them all to update correctly right across the site.
So, is it possible for insert to NOT input the preset sizes when inserting images, so all images site-wide will resize when the preset is changed?
Thanks a lot.
Comments
Comment #1
TelFiRE commentedThis is if I'm not mistaken an issue of core. I am with you, I totally despise this new trend. While web browsing speeds get faster, we worry ourselves sick about smaller and smaller differences in speeds. In order to have a modern website you cannot have these attributes hard coded!
Comment #2
markconroy commentedHi TelFiRE,
I think you are correct. How disappointing:
http://drupal.org/node/1448124
Comment #3
quicksketchYou can override the image-insert-image.tpl.php and insert-image.tpl.php files and remove the height/width attributes if you so desire.
Comment #4
markconroy commentedHi Quicksketch,
Does that just mean copying the image-insert-image.tpl.php file to my theme folder and editing this line:
<img src="<?php print $url ?>" <?php if ($width && $height): ?>width="<?php print $width; ?>" height="<?php print $height; ?>" <?php endif; ?>alt="__alt__" title="__title__" class="image-<?php print $style_name ?><?php print $class ? ' ' . $class : '' ?>" />to this
<img src="<?php print $url ?>" <?php endif; ?>alt="__alt__" title="__title__" class="image-<?php print $style_name ?><?php print $class ? ' ' . $class : '' ?>" />And copying insert-image.tpl.php to my theme folder and editing this line:
<img src="<?php print $url ?>" width="<?php print $width ?>" height="<?php print $height ?>" alt="__alt__" title="__title__" <?php print $class ? 'class="' . $class . '" ' : '' ?>/>to this
<img src="<?php print $url ?>" alt="__alt__" title="__title__" <?php print $class ? 'class="' . $class . '" ' : '' ?>/>If so, why is there always such a simple solution when using Drupal? Thanks sooo much.
Comment #5
quicksketchYep you got it Mark. And don't forget to flush the Drupal cache to get Drupal to pick up the new template file copies.
Comment #7
Anonymous (not verified) commentedDoes this template file approach still work with 7.x-1.3? It seems to have no effect for me, even after clearing the cache.
Comment #8
efpapado commentedSolution #4 doesn't work in 7.x-1.3
Any ideas?
Comment #9
jesss commentedIf you're using an administration theme, simply overriding the tpl.php won't work -- your admin theme can't see the templates in your front-end theme.
What you need to do instead is create a custom module, put your template overrides there, and use hook_theme_registry_alter() to tell the theme system where to find them.
Comment #10
snater commentedAn alternative to creating a custom module is to create a subtheme of the admin theme, described at https://www.drupal.org/node/2203477