HTML image export #642

Closed
opened 2026-02-04 21:33:49 +03:00 by OVERLORD · 6 comments
Owner

Originally created by @gnsiva on GitHub (Apr 13, 2018).

For Bug Reports

  • BookStack Version: 0.20.3
  • PHP Version:
  • MySQL Version: 5.7.21

This is using solidnerd/docker-bookstack

Expected Behavior

HTML export would contain images. These images are copy and pasted into the document, and so are uploaded into the bookstack uploads directory. This works correctly in normal use (expect for export).

Current Behavior

No images are visible in HTML export. When I inspect the html, I can see that it is a relative link which doesn't make sense for an export. e.g.

<img src="/uploads/images/gallery/2018-04-Apr/scaled-840-0/image-1523372744778.png" alt="">

and
<img src="/uploads/images/gallery/2018-04-Apr/scaled-840-0/image-1523372680404.png" alt="">

I guess there should be a way of configuring the server address so that this is filled in before /uploads? Also it would be nice if base64 encoding and embedding the images was also supported.

Steps to Reproduce

Launch solidnerd version of bookstack docker container, paste an image into a bookstack page and try to html export.

Originally created by @gnsiva on GitHub (Apr 13, 2018). ### For Bug Reports * BookStack Version: 0.20.3 * PHP Version: * MySQL Version: 5.7.21 This is using solidnerd/docker-bookstack ##### Expected Behavior HTML export would contain images. These images are copy and pasted into the document, and so are uploaded into the bookstack uploads directory. This works correctly in normal use (expect for export). ##### Current Behavior No images are visible in HTML export. When I inspect the html, I can see that it is a relative link which doesn't make sense for an export. e.g. ```html <img src="/uploads/images/gallery/2018-04-Apr/scaled-840-0/image-1523372744778.png" alt=""> and <img src="/uploads/images/gallery/2018-04-Apr/scaled-840-0/image-1523372680404.png" alt=""> ``` I guess there should be a way of configuring the server address so that this is filled in before `/uploads`? Also it would be nice if base64 encoding and embedding the images was also supported. ##### Steps to Reproduce Launch solidnerd version of bookstack docker container, paste an image into a bookstack page and try to html export.
Author
Owner

@mendiromania commented on GitHub (Apr 18, 2018):

well it's called export to html after all but you could
base64 the img bytes and add it to the img src attribute as "data:image/" . $fileExt . ";base64," . $base64data
http://php.net/manual/en/function.base64-encode.php

@mendiromania commented on GitHub (Apr 18, 2018): well it's called export to html after all but you could base64 the img bytes and add it to the img src attribute as "data:image/" . $fileExt . ";base64," . $base64data http://php.net/manual/en/function.base64-encode.php
Author
Owner

@ssddanbrown commented on GitHub (Apr 21, 2018):

Hi @gnsiva and @mendiromania,

Currently BookStack does attempt to Base64 embed images on the page for exports as shown here:
https://github.com/BookStackApp/BookStack/blob/master/app/Services/ExportService.php#L182

If the image is not found then it's not base64 included.

@gnsiva, Just some questions to help debugging this issue:

  • Are you using the full solidnerd docker-compose setup or just the main BookStack container?
  • Are you setting any image-based configuration environment variables?
  • Have you set the APP_URL environment variable at all?
@ssddanbrown commented on GitHub (Apr 21, 2018): Hi @gnsiva and @mendiromania, Currently BookStack does attempt to Base64 embed images on the page for exports as shown here: https://github.com/BookStackApp/BookStack/blob/master/app/Services/ExportService.php#L182 If the image is not found then it's not base64 included. @gnsiva, Just some questions to help debugging this issue: * Are you using the full solidnerd docker-compose setup or just the main BookStack container? * Are you setting any image-based configuration environment variables? * Have you set the `APP_URL` environment variable at all?
Author
Owner

@gnsiva commented on GitHub (Apr 21, 2018):

@ssddanbrown
To quickly answer, I am using the full docker-compose.
And regarding environment variables, I'm not setting anything other than what is set in the solidnerd setup.

@gnsiva commented on GitHub (Apr 21, 2018): @ssddanbrown To quickly answer, I am using the full docker-compose. And regarding environment variables, I'm not setting anything other than what is set in the solidnerd setup.
Author
Owner

@gnsiva commented on GitHub (Apr 21, 2018):

@ssddanbrown
Sorry, my bad, setting the APP_URL environment variable in the docker-compose file fixed the exporting. It is base64 encoding it too, hurrah!
I will put in an issue to the solidnerd repo that setting the APP_URL should be in the instructions somewhere

@gnsiva commented on GitHub (Apr 21, 2018): @ssddanbrown Sorry, my bad, setting the APP_URL environment variable in the docker-compose file fixed the exporting. It is base64 encoding it too, hurrah! I will put in an issue to the solidnerd repo that setting the APP_URL should be in the instructions somewhere
Author
Owner

@ssddanbrown commented on GitHub (Apr 21, 2018):

@gnsiva Ah, Fantastic, Happy to hear things are working now. Will close this issue.

@ssddanbrown commented on GitHub (Apr 21, 2018): @gnsiva Ah, Fantastic, Happy to hear things are working now. Will close this issue.
Author
Owner

@gnsiva commented on GitHub (Apr 23, 2018):

Thanks for your help!

@gnsiva commented on GitHub (Apr 23, 2018): Thanks for your help!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#642