Skip to content

perf(preview): generate small previews with Imaginary from the original - #65150

Merged
susnux merged 2 commits into
masterfrom
carl/preview-imaginary-resize
Dec 6, 2026
Merged

susnux merged 2 commits into
masterfrom
carl/preview-imaginary-resize

Conversation

@CarlSchwan

Copy link
Copy Markdown
Member

Summary

TODO

  • ...

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@CarlSchwan CarlSchwan added this to the Nextcloud 36 milestone Oct 5, 2026
@CarlSchwan CarlSchwan self-assigned this Oct 5, 2026
@CarlSchwan
CarlSchwan requested a review from a team as a code owner October 5, 2026 15:06
@CarlSchwan
CarlSchwan requested review from leftybournes, provokateurin, salmart-dev and sorbaugh and removed request for a team October 5, 2026 15:06
@CarlSchwan
CarlSchwan force-pushed the carl/preview-imaginary-resize branch 2 times, most recently from 1d88fdc to 6e75735 Compare October 5, 2026 17:45
@CarlSchwan
CarlSchwan added this pull request to stack #65161 October 6, 2026 07:37
Base automatically changed from carl/preview-imagick-scaled-decode to master October 23, 2026 08:50
With Imaginary, only the max preview was generated by Imaginary. Every
other size was then resized in PHP from the fully decoded max preview,
which is exactly the work Imaginary is meant to take over. Let Imaginary
generate them from the original file instead: libvips decodes a JPEG at
a reduced size, so a 256px preview of a 12 MP photo takes about 80ms
instead of a few hundred.

A smaller cached preview is still preferred, resizing it is cheaper than
sending the original to Imaginary. Cropped previews generated this way
use the smartcrop of Imaginary instead of a center crop.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
@susnux
susnux force-pushed the carl/preview-imaginary-resize branch from 6e75735 to ddc70f7 Compare December 5, 2026 23:58
Preview::setMimeType() only accepts a string, so the shared helper now
requires one: callers that already checked the mime type pass the checked
value, which keeps psalm green with a smaller baseline.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@susnux
susnux merged commit b3eef45 into master Dec 6, 2026
150 of 151 checks passed
@susnux
susnux deleted the carl/preview-imaginary-resize branch December 6, 2026 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants