This started today on a website that has been running for over two months. I have a custom module that creates an image using the following code:

$image = image_style_url("catalogue_category_image_size", $product->field_product_image["und"][0]["uri"]);

This also did not work, but was the original code from earlier today:

$image = image_style_url("catalogue_category_image_size", $product->field_product_image["und"][0]["filename"]);

Here is the site, for reference: http://www.boudiccacollection.com/boudicca-catalog

I have no errors at all in the watchdog log or in apache logs. My status report page is green.

The only thing I would note is that the site was recently upgraded to drupal 7.23 from drupal 7.18

I have disabled clean url's to no avail.

EDIT I've added $conf['image_allow_insecure_derivatives'] = TRUE; to my settings.php and it did not correct the issue, however I now have error messages relating to 2 styles of one image (not all styles...)

Watchdog message: http://www.boudiccacollection.com/sites/default/files/styles/catalogue_category_image_size/public/BR004_WEB.jpg?itok=hetdMSsA http://www.boudiccacollection.com/boudicca-catalog Unable to generate the derived image located at public://styles/catalogue_category_image_size/public/BR004_WEB.jpg.

EDIT The same image is used in three places and works in one and not the other two.

Place 1 (broken):

Place 2 (broken):

Place 3 (works):

Place 3 has a different URL even though all of the code should be pulling the same image. Maybe this isn't an image_cache problem...

  • The first thing that comes to mind is to check and make sure $product->field_product_image["und"][0]["uri"] actually points to something valid. I've seen lots of language discussions out there and "und" sticks out. If this no longer points to something good, a quick drupal_set_message() and print_r() of $product should give you what you need.
    – Jimajamma
    Nov 8, 2013 at 17:36
  • The path is valid. Nov 8, 2013 at 17:36

2 Answers 2


There was a change on the Image derivative URLs by the Drupal 7.20 update, as the 7.20 release notes also states:

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/image/example.png will now point to a URL like http://example.com/sites/default/files/styles/thumbnail/public/field/image/example.png?itok=zD_VaCaD.

In addition, any code which programmatically generates a link to an image derivative without using the standard image_style_url() API function will no longer work correctly if the image does not already exist in the file system, since the necessary token will not be present in the URL.

  • If you look at the site I provided, the broken image contains the itok parameter as well as all of the other images that do work. I don't think this is the issue. Nov 8, 2013 at 17:45
  • @ScottJoudry Read the last paragraph carefully...are you sure it's not that? I had to upgrade some code a while back for the same reason; same symptoms that you're having. Check the answer to this question for a code example using image_style_path() instead. Probably worth trying at least
    – Clive
    Nov 8, 2013 at 18:03
  • Clive I did try the answer for that question and it did not work either. Nov 8, 2013 at 19:12
  • I've updated my question with more info Nov 8, 2013 at 19:24

How I fixed this issue:

  1. Removed the image from the node and saved it. This threw an error because it was required, but it still permanently removed the image.
  2. Uploaded the same image and saved the node.

I don't know why this broke or why this fixes it. If I get some time someday I may investigate a little more thoroughly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.