Support PDF attachments with a first-page preview - #1166
Open
lylo wants to merge 3 commits into
Open
Conversation
PDFs join the upload allowlist at 10MB, free tier, counting against the free quota like images. A background job renders the first page once via the Poppler previewer, and the blog page shows it as a thumbnail with a download link and file size beneath, all restylable from custom CSS. The blob partial previously emitted an empty figure for anything that wasn't image, video or audio, which also fed the digest emails, both RSS feeds and exports. Exports now bundle storage-hosted links as well as images, and the figcaption Markdown converter keeps links rather than flattening them to text.
?post=<token> on the individual preview renders a specific post rather than the latest, reusing its digest if one already exists.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PDFs couldn't be attached to posts at all. Worksheets, papers and zines are exactly the sort of thing people want to hang off a post, and Lexxy already supports them end to end; the block was ours.
What changed
application/pdfjoinsUploadLimits::CONTENT_TYPESat 10MB, free tier, counting against the free quota like images. That one constant gates the editor, API, Micropub and posting by email.GeneratePdfPreviewJobrenders the first page to a PNG once, triggered when the blob is attached, so all four ingress routes are covered. Requirespdftoppm(poppler), already on the server and now installed in CI; without it the job no-ops and the chip renders instead.<figure>for any non-media type, which also fed digest emails, both RSS feeds and exports.Behaviour changes
downloadattribute); a true attachment-disposition download is deliberately left for later.