Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to generate the derived image using image_style_url

Im seeing the following message within Reports when I attempt to use the image_style_url function on an image : "Unable to generate the derived image located at public://..."

I have ensured that the directory is under Apache's ownership and I have no problems attaching images for upload to other nodes.

The style name "template" has been set up within the "Image Styles" menu in the Drupal Administration panel.

When the function is called, an image URL is being returned but the image is not displaying because the image is not being created by the server.

Does anyone have any ideas as to how I can fix this issue?

I am simply printing image_style_url, where "thumbnail" is a name given to the image style that was created in the admin area.

$img_url = $node->field_image[0]['uri'];
print image_style_url("thumbnail", $img_url);
like image 928
Dave O'Dwyer Avatar asked Jul 04 '12 16:07

Dave O'Dwyer


2 Answers

I just had had this problem generating sites/default/files/styles/newsletter_thumbnail/public/Scotland_bankers_2.jpg - it turned out that the file Scotland_bankers_2.jpg didn't exist in the /files/ folder so there was nothing to generate!

like image 171
ankles Avatar answered Nov 20 '22 18:11

ankles


The $img_url your passing may be invalid. Check if uri value is accessible. Do you have multiple images in one field?

I think you should be accessing the data like this:

$node->field_image[$node->language][0]['uri']

I encountered the same error before when my image was deleted.

like image 1
claire Avatar answered Nov 20 '22 19:11

claire