Drupal 8 - image styles that do not appear when loading the first page

I use Entity Browser to download images and responsive image styles to display them.

I find that after creating the node and adding the image, when the first user visits the page, the image will not be displayed. When the page is refreshed, an image will be displayed.

  • I tried with or without a variable, the same result.

  • I tried using a responsive image style and a regular image style with the same result.

  • When the image is first loaded into the backend, the sketch does not work the show.

  • The image loads correctly and is located in the file folder.

When loading the first page, an image style is created, and I see it in the styles folder, and it opens fine in windows, but if I look at the URL of the image styles (... / styles / stylename / public / folder / image.jpg) the message "Image cannot be displayed because it contains errors." If I do keep up to date, the image will appear, and then go back and refresh the page and the image will be there.

It seems that the browser is trying to load the image from the cache for the first time, and it does not exist, so the URL is broken.

I would like to hear if someone else has encountered this problem. Tried everything I can think of.

+6
source share
1 answer

The first character in a broken image file is a newline character. If you delete the first byte, the image can be displayed successfully.

This means that somewhere in your PHP code you have an unexpected new line, or before the tag. If this happens on only one site, then template.php in your topic is a good place to start your search. refer to https://www.drupal.org/node/2195311

+2
source

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


All Articles