Failed to create derived image using image_style_url

I see the following message in reports when I try to use the image_style_url function on an image: "Cannot generate a derived image located in public: // ..."

I made sure the directory is owned by Apache and I have no problem attaching images to upload to other sites.

The style name "template" was configured in the "Image Styles" menu in the Drupal admin panel.

When the function is called, the URL of the image is returned, but the image is not displayed because the image is not created by the server.

Does anyone have any ideas on how I can fix this problem?

I just print image_style_url, where "thumbnail" is the name assigned to the image style created in the admin area.

$img_url = $node->field_image[0]['uri']; print image_style_url("thumbnail", $img_url); 
+6
source share
3 answers

I just had a problem creating sites / default / files / styles / newsletter _thumbnail / public / Scotland_bankers_2.jpg - it turned out that the Scotland_bankers_2.jpg file did not exist in the / files / folder, so there was nothing to generate!

+2
source

$ img_url your transfer may not be valid. Check if uri value is available. Do you have several images in one field?

I think you should access the following data:

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

I found the same error before my image was deleted.

+1
source

did style for this look? this is how to print img from a custom template

  $style='full_content_width'; $path=$node->my_img_field['und']['0']['uri']; $style_url = image_style_url($style, $path); print "<img src=".file_create_url($style_url)." >"; 
0
source

Source: https://habr.com/ru/post/919690/


All Articles