Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If an image has a space in the filename, the "file_exists" check in adaptive_image_preprocess_image() returns false. This causes the "styles" URL - which regenerates the image - to be used as the image path, rather than the URL of the previously cached image. This is because the $derivative_uri is urlencoded at the time file_exists() tries to find the file.
Patch forthcoming.
Comment | File | Size | Author |
---|---|---|---|
#1 | adaptive_images-cache_fix-2053047-1.patch | 733 bytes | jim_keller |
Comments
Comment #1
jim_keller CreditAttribution: jim_keller commentedattached patch is against the dev branch of 7.x-1.x.
Note that I've added a urldecode() around $derivative_uri, which seems to work. However, I didn't look into *why* the filepath is encoded. I'm not sure if that's the expected behavior for preprocess_image, but if not, it may be worthwhile to urldecode (or simply not urlencode) somewhere further up the chain.
Comment #2
Baysaa CreditAttribution: Baysaa commentedIn my local testing I have also found the file_exists() check gets passed a path with querystring attached to it (itok=XXXX) in adaptive_image_preprocess_image. This causes file_exists to fail as well. Removing the itok querystring makes file_exists return true again. This has been causing a lot of stress on our server as it was regenerating the images on every call. And to make matters worse Varnish isn't caching these images for some reason (this is probably a misconfiguration on our end).