Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML image export #799

Closed
gnsiva opened this issue Apr 13, 2018 · 6 comments
Closed

HTML image export #799

gnsiva opened this issue Apr 13, 2018 · 6 comments

Comments

@gnsiva
Copy link

gnsiva commented 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.

@mendiromania
Copy link

mendiromania commented 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

@ssddanbrown
Copy link
Member

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?

@gnsiva
Copy link
Author

gnsiva commented 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
Copy link
Author

gnsiva commented 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

@ssddanbrown
Copy link
Member

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

@gnsiva
Copy link
Author

gnsiva commented Apr 23, 2018

Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants