Skip to content

Withdrawn - #24

Closed
Kendrick-Bollens wants to merge 2 commits into
ttpears:mainfrom
Kendrick-Bollens:feat/image-gallery-tools
Closed

Withdrawn#24
Kendrick-Bollens wants to merge 2 commits into
ttpears:mainfrom
Kendrick-Bollens:feat/image-gallery-tools

Conversation

@Kendrick-Bollens

@Kendrick-Bollens Kendrick-Bollens commented Sep 1, 2026

Copy link
Copy Markdown

Withdrawn.

Kendrick Bollens added 2 commits September 1, 2026 21:12
Adds get_images, get_image, create_image and delete_image, closing the gap
that made images the one kind of page content this server could not produce.
Attachments hang a file off a page; only a gallery image can be referenced
from the page body, and /api/image-gallery was unreachable from here.

create_image takes a path and returns the hosted URL plus BookStack's own
content.markdown / content.html snippets, so the caller embeds the result with
a normal update_page. The bytes never enter the conversation — the alternative,
inlining a data: URI, forces the model to *generate* ~1.37 bytes of base64 per
image byte as output tokens.

The upload deliberately goes through the existing axios instance rather than a
separate fetch path, so it inherits the concurrency semaphore, the 429
retry/backoff, the timeout and the TLS opt-out. That needs one per-request
override, `Content-Type: undefined`: the instance default is application/json,
and with it set axios never selects its form-data serializer. It JSON-encodes
the FormData instead, flattening the file to `"image":{}` — verified against a
local socket, which is what the resulting 422 actually means.

Two details taken from BookStack's source rather than assumed
(getImageValidationRules in app/Http/Controller.php):
  ['image_extension', 'mimes:jpeg,png,gif,webp,avif', 'max:' . (config('app.upload_limit') * 1000)]
so SVG is NOT an accepted gallery format and AVIF is. Format and size are
checked client-side to fail with an actionable message instead of an opaque 422,
and image errors now surface BookStack's response body.

create_image is registered on stdio only. It reads from the filesystem of the
machine running the server, which is meaningful only when that is the caller's
own machine. Over HTTP the server is remote and shared, so a caller-supplied
path would be an arbitrary-file-read primitive against the host; the capability
is threaded in separately from BookStackConfig because the HTTP path reuses the
same config objects across sessions.

Refs #11.
…riginal

Verified live against BookStack 26.x: content.markdown returns
.../gallery/2026-09/scaled-1680-/<file> while url is the original upload.
@Kendrick-Bollens Kendrick-Bollens changed the title feat: image gallery tools — upload images for embedding in page content Withdrawn Sep 1, 2026
@Kendrick-Bollens
Kendrick-Bollens deleted the feat/image-gallery-tools branch September 2, 2026 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant