Closed (duplicate)
Project:
Client-Side Adaptive Image
Version:
7.x-1.0-alpha2
Component:
Code
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
16 May 2012 at 11:41 UTC
Updated:
18 Jul 2012 at 20:14 UTC
I've experienced that images are added more than once - a specially when closing overlays and lightboxes.
I made a small fix in cs_adaptive_image.js that seems to fix my troubles.
| Comment | File | Size | Author |
|---|---|---|---|
| cs_adaptive_image-fix_for_double_inserts.patch | 686 bytes | olemsa |
Comments
Comment #1
zenlan commentedI have come across the same problem in various scenarios and have whittled it down to local conflict with any other ajax that is fired off from a page with an adaptive image embedded. I created a simple and hopefully repeatable demonstration of the issue.
Your patch appears to fix the problem certainly in this test scenario and also with a Views Slideshow block that uses adaptive images.
Test prior to applying the patch:
Build a small module that declares a block that contains a simple form with an ajax callback, the form code is taken from Drupal Ajax Examples.
Create a View with a block that contains nothing but an image, you will need some Articles with images for this particular view or you can substitute any content type that has an Image field. The Image field formatter is set to 'Image':
Place these two blocks on a page somewhere, preferably without other form/ajax/media elements.
Click the button to submit the form. The text in that block should change, the image should be unaffected.
Go to the View and change the Image formatter to 'Adaptive image'.
Refresh the page with the blocks, click the button to submit the form. The text in that block should change, the image should be unaffected but for me 3 duplicate images appear and each time I click the button another 3 duplicate images are added.
Repeat test after applying the patch, for me it worked. Also worked when I substituted my views_slideshow block for the image block, the slideshow continued to work normally.
Comment #2
drew reece commentedDoes this patch need to add the 'adaptive-image-processed' class?
I thought that was what
once('adaptive-image')did?There is another variation of this issue over at http://drupal.org/node/1667874
Comment #3
david lesieur commentedThanks olemsa for the patch, and zenlan for the detailed report.
Other patches have been proposed in #1667874: Image inserted twice when ajax form submitted on page with CS adaptive images, so even though you have posted first, I'll mark this as a duplicate. You are welcome to review the solutions proposed there.