If you have more than one resized version of the same image in a text the width/height settings of the first one is copied to the following ones.
Could the use of static variables in image_resize_fitler_update_tag be the reason for that issue?
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | image_resize_filter_multiple.patch | 1.16 KB | quicksketch |
| #2 | resize_filter_bug.jpg | 13.11 KB | der_tisch |
Comments
Comment #1
quicksketchI'm not quite following what's wrong. Could you provide an example of the files being generated?
Comment #2
der_tisch commentedThis:
generates this:
As you can see in the attached screenshot the size of the second image is correct. This is due to the style attribute which has priority.
But the attributes source, width and height seem to be remembered from the processing of the first image and are applied to the second one again.
The files directory though contains the correct files:
cat-53x53.jpg
cat-204x204.jpg
I hope that helps.
Apart from that:
Thank you for this great module! :-) In conjunction with a wysiwyg editor, filefield_paths, imagefield_tokens and filefield_insert it lets even inexperienced users create nice looking pages without having them teached how to organize their images and the bunch of different versions.
-Tim
Comment #3
quicksketchExcellent, thanks for the exhaustive report! I was able to reproduce the problem exactly as you described. It looks like the problem is because the first time an image is resized, the regular expression replaces based on the "src" property, and will replace all the images that match that path. Subsequent replacements then don't find anything at all, so the later images are never generated.
The fix is quite simple, just make it so that the regular expression only makes one replacement. To work properly, the images must be found and replaced in the same order, but since this is the case already we shouldn't have any troubles. Could you try out this patch and let me know if it causes any problems? You'll need to clear your Drupal caches for it to take effect (click "Clear all caches" at admin/settings/performance). Thanks!
Comment #4
der_tisch commentedThe patch command said:
Hunk #2 FAILED at 427.
But I was able to change that line manually. (I had to just add that method argument ', 1', right?)
Everything seem to work fine know. Thanks for the fast solution.
Comment #5
quicksketchYep, that's the only change. I've committed this to the development version and it'll be included in 1.5.
Comment #7
philbar commentedConfirmed the fix. Everything is working as expected. Thanks!