[PR #2700] [MERGED] Add base64 image blob support #6045

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

📋 Pull Request Information

Original PR: https://github.com/BookStackApp/BookStack/pull/2700
Author: @awarre
Created: 4/21/2021
Status: Merged
Merged: 6/2/2021
Merged by: @ssddanbrown

Base: masterHead: master


📝 Commits (1)

📊 Changes

1 file changed (+59 additions, -0 deletions)

View changed files

📝 app/Entities/Tools/PageContent.php (+59 -0)

📄 Description

Overview

This allows usage of base64 image blobs in pages by parsing them from posts during submission and saving them as images. This ties almost entirely into existing code.

Based on our discussion in #2631, I think this solution would be preferable.

Benefits
Even if this exact pull request isn't accepted, a solution with this design has many benefits.

  • Avoids storing images as text blobs in the database, instead saving them as native BookStack images.
  • Integrated directly into BookStock rather than tied to WYSIWYG editors, which could change in the future.
  • Allows importing image data via the API. Export formats from knowledge systems (including BookStack's own) often use base64 image blobs. Importing with them with the API is currently more difficult than necessary.
  • Allows copying and pasting from external sources with multiple images. The end-user doesn't need to think or know about what their datasource is or their image formats are. This is a huge benefit to usability when working with complex source information that includes images.
  • Handled server-side rather than client-side. Client-side restrictions can be easily bypassed, deliberately and accidentally.

TODO

  • saveBase64Images functionality could be moved into formatHtml. The current design was to give a clear separation from existing code, as well as give imageRepo access to the Page object.
  • This method relies heavily on the Drawio saveDrawing method. The Drawio class could be abstracted a bit. The directory and file naming in particular are very Drawio-centric.
  • To fully support this client-side, the Javascript restrictions on image blobs will need to be removed.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/BookStackApp/BookStack/pull/2700 **Author:** [@awarre](https://github.com/awarre) **Created:** 4/21/2021 **Status:** ✅ Merged **Merged:** 6/2/2021 **Merged by:** [@ssddanbrown](https://github.com/ssddanbrown) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`f8b5a0f`](https://github.com/BookStackApp/BookStack/commit/f8b5a0fd503a06acae2dd4a928b6992e30280b79) Add base64 image support ### 📊 Changes **1 file changed** (+59 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `app/Entities/Tools/PageContent.php` (+59 -0) </details> ### 📄 Description **Overview** This allows usage of base64 image blobs in pages by parsing them from posts during submission and saving them as images. This ties almost entirely into existing code. Based on our discussion in #2631, I think this solution would be preferable. **Benefits** Even if this exact pull request isn't accepted, a solution with this design has many benefits. - Avoids storing images as text blobs in the database, instead saving them as native BookStack images. - Integrated directly into BookStock rather than tied to WYSIWYG editors, which could change in the future. - Allows importing image data via the API. Export formats from knowledge systems (including BookStack's own) often use base64 image blobs. Importing with them with the API is currently more difficult than necessary. - Allows copying and pasting from external sources with multiple images. The end-user doesn't need to think or know about what their datasource is or their image formats are. This is a huge benefit to usability when working with complex source information that includes images. - Handled server-side rather than client-side. Client-side restrictions can be easily bypassed, deliberately and accidentally. **TODO** - [ ] saveBase64Images functionality could be moved into formatHtml. The current design was to give a clear separation from existing code, as well as give imageRepo access to the Page object. - [ ] This method relies heavily on the Drawio saveDrawing method. The Drawio class could be abstracted a bit. The directory and file naming in particular are very Drawio-centric. - [ ] To fully support this client-side, the Javascript restrictions on image blobs will need to be removed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-05 10:23:18 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#6045