Some of our sites have external images that are dynamically created, and it's not feasible to clear the cache or resave the nodes every time the image would need to change.

Ideally we'd like to continue to run the filter on external images, except for these specific files...maybe by adding a setting to "exclude these URLs"?

Comments

jdanthinne’s picture

Would also be useful to add a class to the image to force it not to be processed.
In my case, I'd need that to add image without any dimensions and style them width max-width:100% so it becomes responsive. When processed with this filter, width and height tags are added, and it doesn't work (height tag should not be there for the responsive effect).

quicksketch’s picture

@jdanthinne: Could you post a sample of the HTML you expect to use? There's no reason why image resize filter wouldn't work fine with an original-size image that had a class or a width of 100% set in the style tag.

jdanthinne’s picture

I'd expect to use a simple img tag like <img src="pic.jpg" class="adaptive-image"/> (the adaptive-image css class is "max-width:100%")

If I insert that in my body field, without the image resize filter, it works fine, and nothing is added.

As soon as I enable the filter, it adds the width and height attributes with the real dimensions, and it stops to work. Even if I add width="100%" in the style attribute of the image, it stills outputs width and height attributes, and the image is distorted (width is fine, but height remains at original size).

For now, I've disabled the filter for those images to work, but I'd rather use it with an option for some image to choose if dimensions attributes are used or not.

quicksketch’s picture

the adaptive-image css class is "max-width:100%"

You should *always* have a height and width specified in the HTML attributes. It helps the browser render the page faster. In your CSS, you need not only a width attribute but also a height. Try something like this in your CSS:

width: 100%;
height: auto;
jdanthinne’s picture

You're right. I was using the width and height attributes and that wasn't working, but by using the style tag, it works fine, thanks for the tip.
I've just noticed a small error by the way, each time I edited a node to change those tags, after saving, I get two notices by image (but not there when I reload the page):

Notice: Undefined index: width in image_resize_filter_get_images() (line 378 of /home/liegebio/www/sites/all/modules/image_resize_filter/image_resize_filter.module).
Notice: Undefined index: height in image_resize_filter_get_images() (line 378 of /home/liegebio/www/sites/all/modules/image_resize_filter/image_resize_filter.module).
jdanthinne’s picture

Wow, I've just cleared the cache, and I got all thoses notices back (two for each image on the site).