Problem
Since Drupal 7.20, the file_exists function under adaptive_image_preprocess_image() always returns false, hence adaptive_image is always serving the default image regardless of screen size. This is due to the newly introduced image token in Drupal 7.20.
The security fixes in this release change all image derivative URLs generated by Drupal to append a token as a query string. ("Image derivatives" are copies of images which the Drupal Image module automatically creates based on configured image styles; for example, thumbnail, medium, large, etc.)
As an example, links that previously pointed to a URL like http://example.com/sites/default/files/styles/thumbnail/public/field/ima... will now point to a URL like http://example.com/sites/default/files/styles/thumbnail/public/field/ima....
Prior to Drupal 7.20, adaptive_image_preprocess_image() is checking for
file_exists('./sites/default/files/styles/thumbnail/public/field/image/example.png');
Since Drupal 7.20, adaptive_image_preprocess_image() is now checking for
file_exists('./sites/default/files/styles/thumbnail/public/field/image/example.png?itok=zD_VaCaD');
Solution
Strip the query string from the path before calling file_exists()
Patch to follow.
Comment | File | Size | Author |
---|---|---|---|
#1 | adaptive_image-strip-query-string-1956810.patch | 1.06 KB | makangus |
Comments
Comment #1
makangus CreditAttribution: makangus commentedPatch
Comment #2
jamescook CreditAttribution: jamescook commentedCan confirm this, seems to work with patch. Thanks.
Comment #3
ajFernandez CreditAttribution: ajFernandez commentedI can confirm this patch is working for me!
@makangus thanks for the patch!