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);
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!
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With