Booth Wiki Booth Wiki
Pages

api/preview

Return an inline preview of a single file. The response is the preview content itself (image bytes, audio stream, truncated text, or an archive listing), not JSON. Previewable types: images, mp3/aac audio, text files, zip and tar archives.

URL:

HTTP Method:

  • GET

Parameters:

  • size - preview sizing hint.
    • Images: width in pixels (480) or WxH (800x600); default 480 wide.

    • tar archives: maximum number of entries to list (default 25). zip archives ignore size and always list the first 20 entries.

    • Audio (mp3/aac): ignored; use info / pic instead.
    • Text files: passing size currently triggers an HTTP 500 (server bug); without it, text previews return the first 512 characters.
  • info - true on audio files: returns JSON tag metadata (album, artist, title) as text/plain.

  • pic - true on mp3 files: returns embedded album art, or a placeholder image when the file has none.

Response:

  • 200 with an appropriate Content-Type (image/*, audio/mpeg, text/plain, …) and Content-Disposition: inline. Previews are cached for one month (Cache-Control: max-age).

  • 404 - unknown user, batch, or file, or no previewer for the file type.
  • 400 - invalid size value or corrupt zip archive.
  • 502 - image preview service unavailable.