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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

makangus’s picture

jamescook’s picture

Can confirm this, seems to work with patch. Thanks.

ajFernandez’s picture

I can confirm this patch is working for me!

@makangus thanks for the patch!