Uploaded Images Show as Placeholder #2964

Closed
opened 2026-02-05 05:52:10 +03:00 by OVERLORD · 10 comments
Owner

Originally created by @MrMKJ on GitHub (Aug 15, 2022).

Describe the Bug

Uploaded/inserted images are rendering as a placeholder image, both on the edit and saved page views.

TestPage

TestPage_Edit

Steps to Reproduce

  1. Enter edit mode for a page.
  2. Upload an image to the page via copy & past, drag & drop, or the Insert Image dialog.
  3. Select image to insert (if using the Insert Image dialog)

Expected Behaviour

Uploaded images to render and be viewable in the browser.

Screenshots or Additional Context

The generated thumbnail is visible in the Insert Image dialog, however the generated scaled-1680- image renders as a placeholder.

TestPage_ImageSelect

Clicking on the image link attempts to open the original in another tab, but this again renders as a placeholder. However directly calling the thumbnail (https://site.domain/uploads/images/gallery/2022-08/thumbs-150-150/bookstacktest.JPG) is successful.

direct_thumbnail

The browser dev tools networking tab suggest that the images are being served successfully.

TestPage_ImageNetwork

The dev tools console shows no 404, or other errors. However, the console in Edge does show the following warning.

TestPage_ImageConsole

(The link forwards to a chrome issue https://bugs.chromium.org/p/chromium/issues/detail?id=846170)

The original image, and the auto generated visions (scaled-1680- & thumbs-150-150), are all being correctly stored in storage/uploads/images/gallery/yyyy-MM/... , and display correctly when downloaded and viewed locally. They can also be successfully managed (e.g. deleted), from the in editor Image dialogue.

Browser Details

Firefox (103.0.2), Chrome (104.0.5112.81), Edge (104.0.1293.54), Opera (89.0.4447.91), Vivaldi (5.4.2753.33)

Exact BookStack Version

v22.07.1

PHP Version

8.0.17

Hosting Environment

  • BookStack Version: v22.07.1
  • PHP Version: 8.0.17
  • MySQL Version: 8.0
  • Webserver: nginx/1.14.2
  • OS: Debian GNU/Linux 10 (buster)

The site is hosted on an Azure App Service (Linux) instance, using the default PHP 8 container.

The site sits behind the default app service gateway/ssl proxy, and nginx has been configured to serve from the /public folder.

Images are configured to serve from local_secure storage, and the storage/uploads folder is mounted from an Azure storage file share - permission are broad for testing (0777 nobody/nogroup).

Auth is via the Azure AD third party authentication option.

Originally created by @MrMKJ on GitHub (Aug 15, 2022). ### Describe the Bug Uploaded/inserted images are rendering as a placeholder image, both on the edit and saved page views. ![TestPage](https://user-images.githubusercontent.com/40501541/184597376-11db6b3a-0ca9-4d2c-a99f-55261e5cfeb9.JPG) ![TestPage_Edit](https://user-images.githubusercontent.com/40501541/184597410-e1a16867-9651-4baa-89f9-a816c2f45541.JPG) ### Steps to Reproduce 1. Enter edit mode for a page. 2. Upload an image to the page via copy & past, drag & drop, or the Insert Image dialog. 3. Select image to insert (if using the Insert Image dialog) ### Expected Behaviour Uploaded images to render and be viewable in the browser. ### Screenshots or Additional Context The generated thumbnail is visible in the Insert Image dialog, however the generated scaled-1680- image renders as a placeholder. ![TestPage_ImageSelect](https://user-images.githubusercontent.com/40501541/184597938-8a068bee-4983-4fa4-a6a6-5c283a6b34b7.JPG) Clicking on the image link attempts to open the original in another tab, but this again renders as a placeholder. However directly calling the thumbnail (https://site.domain/uploads/images/gallery/2022-08/thumbs-150-150/bookstacktest.JPG) is successful. ![direct_thumbnail](https://user-images.githubusercontent.com/40501541/184599959-903b070c-6da9-4c3c-8015-fdc1b780990f.JPG) The browser dev tools networking tab suggest that the images are being served successfully. ![TestPage_ImageNetwork](https://user-images.githubusercontent.com/40501541/184597846-d25e5673-8a0b-4cef-a5f0-cda976c51f62.JPG) The dev tools console shows no 404, or other errors. However, the console in Edge does show the following warning. ![TestPage_ImageConsole](https://user-images.githubusercontent.com/40501541/184597876-016386e0-ddd8-4b9d-97af-a747442320c3.JPG) *(The link forwards to a chrome issue https://bugs.chromium.org/p/chromium/issues/detail?id=846170)* The original image, and the auto generated visions (scaled-1680- & thumbs-150-150), are all being correctly stored in storage/uploads/images/gallery/yyyy-MM/... , and display correctly when downloaded and viewed locally. They can also be successfully managed (e.g. deleted), from the in editor Image dialogue. ### Browser Details Firefox (103.0.2), Chrome (104.0.5112.81), Edge (104.0.1293.54), Opera (89.0.4447.91), Vivaldi (5.4.2753.33) ### Exact BookStack Version v22.07.1 ### PHP Version 8.0.17 ### Hosting Environment * **BookStack Version:** v22.07.1 * **PHP Version:** 8.0.17 * **MySQL Version:** 8.0 * **Webserver:** nginx/1.14.2 * **OS:** Debian GNU/Linux 10 (buster) The site is hosted on an Azure App Service (Linux) instance, using the default PHP 8 container. The site sits behind the default app service gateway/ssl proxy, and nginx has been configured to serve from the /public folder. Images are configured to serve from local_secure storage, and the storage/uploads folder is mounted from an Azure storage file share - permission are broad for testing (0777 nobody/nogroup). Auth is via the Azure AD third party authentication option.
OVERLORD added the 🐛 Bug label 2026-02-05 05:52:10 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Aug 15, 2022):

Hi @MrMKJ,
Does this behavior occur for all types of images?

I'm wondering if this behavior could occur if an image was uploaded with an incorrect extension.
The image shown is named as "JPG" but appears to be a screenshot which would typically be png.
The thumbnails may work since they'd be specifically re-encoded as jpeg, to match the extension, during the upload process.

@ssddanbrown commented on GitHub (Aug 15, 2022): Hi @MrMKJ, Does this behavior occur for all types of images? I'm wondering if this behavior could occur if an image was uploaded with an incorrect extension. The image shown is named as "JPG" but appears to be a screenshot which would typically be png. The thumbnails may work since they'd be specifically re-encoded as jpeg, to match the extension, during the upload process.
Author
Owner

@MrMKJ commented on GitHub (Aug 15, 2022):

Hi @ssddanbrown

Thanks for getting back to me so quickly!

The reason I was uploading jpg was to try to test with formats other than PNG.

As you can see from the screen-shot below, the issue manifests for PNG & JPG - however for some PNG files the thumbnail is also not rendering.

TestPage_ImageSelect2

Again the dev tools console shows no 404 errors, while networking suggests all images are being successfully served to the client.

TestPage_devtools

Additionally, if I download the contents of the gallery locally, all the images - original and generated - are viewable.

local_images

@MrMKJ commented on GitHub (Aug 15, 2022): Hi @ssddanbrown Thanks for getting back to me so quickly! The reason I was uploading jpg was to try to test with formats other than PNG. As you can see from the screen-shot below, the issue manifests for PNG & JPG - however for some PNG files the thumbnail is also not rendering. ![TestPage_ImageSelect2](https://user-images.githubusercontent.com/40501541/184654482-9c02e260-9fd0-498e-accc-5b2742a44721.PNG) Again the dev tools console shows no 404 errors, while networking suggests all images are being successfully served to the client. ![TestPage_devtools](https://user-images.githubusercontent.com/40501541/184656290-d4d94c47-f346-4515-803d-8ebf1a633d55.PNG) Additionally, if I download the contents of the gallery locally, all the images - original and generated - are viewable. ![local_images](https://user-images.githubusercontent.com/40501541/184658008-661b5eeb-2d70-4fe6-9108-28440bf4257e.PNG)
Author
Owner

@ssddanbrown commented on GitHub (Aug 15, 2022):

Thanks for confirming @MrMKJ. Could you:

  • Share/attach the testpng.png file, just so I have an exact failing case to work with.
  • On one of the failing images, can you click the entry in the displayed network area of the devtools and share what the "Response" tab shows.
@ssddanbrown commented on GitHub (Aug 15, 2022): Thanks for confirming @MrMKJ. Could you: - Share/attach the `testpng.png` file, just so I have an exact failing case to work with. - On one of the failing images, can you click the entry in the displayed network area of the devtools and share what the "Response" tab shows.
Author
Owner

@MrMKJ commented on GitHub (Aug 15, 2022):

HI @ssddanbrown

The response tab shows no data for the request.

TestPage_devtools_response

Here is the testpng.png file requested.

testpng

@MrMKJ commented on GitHub (Aug 15, 2022): HI @ssddanbrown The response tab shows no data for the request. ![TestPage_devtools_response](https://user-images.githubusercontent.com/40501541/184678001-691490a0-8ba2-4a7b-abec-31d8058c599f.PNG) Here is the testpng.png file requested. ![testpng](https://user-images.githubusercontent.com/40501541/184678250-ddd758af-2a10-409e-86ed-797e24b23ee0.png)
Author
Owner

@ssddanbrown commented on GitHub (Aug 23, 2022):

Sorry for the late response. I still cannot reproduce this. I think it's likely that certain webserver-level config is affecting things here.

Can you provide a full view of the cookie and header tabs for a failing image, obfuscating any key values within?

@ssddanbrown commented on GitHub (Aug 23, 2022): Sorry for the late response. I still cannot reproduce this. I think it's likely that certain webserver-level config is affecting things here. Can you provide a full view of the cookie and header tabs for a failing image, obfuscating any key values within?
Author
Owner

@MrMKJ commented on GitHub (Aug 24, 2022):

Hi @ssddanbrown

Thanks again for getting back to me on this issue!

Here are the headers & cookies tab screenshots you requested...

TestImage_Headers

TestImage_Cookies

@MrMKJ commented on GitHub (Aug 24, 2022): Hi @ssddanbrown Thanks again for getting back to me on this issue! Here are the headers & cookies tab screenshots you requested... ![TestImage_Headers](https://user-images.githubusercontent.com/40501541/186389370-42acd1b7-f812-4fa2-b1e1-951c61d6cdf7.png) ![TestImage_Cookies](https://user-images.githubusercontent.com/40501541/186389419-227e35fe-4558-4559-8c35-03e6516f35e3.png)
Author
Owner

@MrMKJ commented on GitHub (Aug 24, 2022):

Additionally, as I didn't include it earlier, here is the nginx config...

server {
    #proxy_cache cache;
    #proxy_cache_valid 200 1s;
    listen 8080;
    listen [::]:8080;

    absolute_redirect off;

    root /home/site/wwwroot/public;
    index index.php index.html index.htm;

    server_name example.com www.example.com;

    client_max_body_size 100M;

	location / {
        try_files $uri $uri/ /index.php$is_args$query_string;
	}

    # redirect server error pages to the static page /50x.html
    # error_page   500 502 503 504  /50x.html;
    # location = /50x.html {
    #     root   /html/;
    # }

    # Disable .git directory
    location ~ /\.git {
        deny all;
        access_log off;
        log_not_found off;
    }

    # Add locations of phpmyadmin here.
    location ~ \.php$ {
        fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param HTTP_PROXY "";
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param QUERY_STRING $query_string;
        fastcgi_intercept_errors on;
        fastcgi_connect_timeout         300;
        fastcgi_send_timeout           3600;
        fastcgi_read_timeout           3600;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 4 256k;
        fastcgi_busy_buffers_size 256k;
        fastcgi_temp_file_write_size 256k;
    }
}

I normally use the default Apache/php7.4 image, but this can be problematic for some Laravel apps, as it relies solely on htaccess files for the /public folder redirect, and offers no coinvent way of re-writing the the apache site config files - with the nginx/php8 image this can be achieved with a start-up script to re-write the site config.

@MrMKJ commented on GitHub (Aug 24, 2022): Additionally, as I didn't include it earlier, here is the nginx config... ``` server { #proxy_cache cache; #proxy_cache_valid 200 1s; listen 8080; listen [::]:8080; absolute_redirect off; root /home/site/wwwroot/public; index index.php index.html index.htm; server_name example.com www.example.com; client_max_body_size 100M; location / { try_files $uri $uri/ /index.php$is_args$query_string; } # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; # location = /50x.html { # root /html/; # } # Disable .git directory location ~ /\.git { deny all; access_log off; log_not_found off; } # Add locations of phpmyadmin here. location ~ \.php$ { fastcgi_split_path_info ^(.+?\.php)(|/.*)$; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param HTTP_PROXY ""; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param QUERY_STRING $query_string; fastcgi_intercept_errors on; fastcgi_connect_timeout 300; fastcgi_send_timeout 3600; fastcgi_read_timeout 3600; fastcgi_buffer_size 128k; fastcgi_buffers 4 256k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; } } ``` I normally use the default Apache/php7.4 image, but this can be problematic for some Laravel apps, as it relies solely on htaccess files for the /public folder redirect, and offers no coinvent way of re-writing the the apache site config files - with the nginx/php8 image this can be achieved with a start-up script to re-write the site config.
Author
Owner

@ssddanbrown commented on GitHub (Aug 24, 2022):

Can't see anything wrong in the above. Thought it could be something specific to the nginx/php handling but I copied the config to my own environment and could not reproduce the issue.

Running out of ideas, almost feel like the connection is being dropped azure side before data is sent.
Could you maybe show the "Timing" tab for a non-working image request? Just to maybe get an idea of what might be happening to these requests.

@ssddanbrown commented on GitHub (Aug 24, 2022): Can't see anything wrong in the above. Thought it could be something specific to the nginx/php handling but I copied the config to my own environment and could not reproduce the issue. Running out of ideas, almost feel like the connection is being dropped azure side before data is sent. Could you maybe show the "Timing" tab for a non-working image request? Just to maybe get an idea of what might be happening to these requests.
Author
Owner

@nhmw-bnovak commented on GitHub (Sep 14, 2022):

Hi There,
I have the same issue, but for some reason it only happened to one of my pictures I included in my book. See Screenshot attached. I deleted the old pic, made a new screenshot, uploaded it and used this one instead of the old, broken one. Now it's working fine again. I am not sure why this problem came up with this one picture but not with others.

Bildschirmfoto 2022-09-14 um 11 08 36

@nhmw-bnovak commented on GitHub (Sep 14, 2022): Hi There, I have the same issue, but for some reason it only happened to one of my pictures I included in my book. See Screenshot attached. I deleted the old pic, made a new screenshot, uploaded it and used this one instead of the old, broken one. Now it's working fine again. I am not sure why this problem came up with this one picture but not with others. ![Bildschirmfoto 2022-09-14 um 11 08 36](https://user-images.githubusercontent.com/112375144/190112641-7304bb7a-7303-4182-9ee6-fe23c83c5b57.png)
Author
Owner

@ssddanbrown commented on GitHub (Sep 20, 2022):

@nhmw-bnovak If it's reproducible feel free to open a new specific issue for your case.

Since there hasn't be a response for a while from the issue author I'm going to go ahead and close this off.

@ssddanbrown commented on GitHub (Sep 20, 2022): @nhmw-bnovak If it's reproducible feel free to open a new specific issue for your case. Since there hasn't be a response for a while from the issue author I'm going to go ahead and close this off.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#2964