Repository navigation
feat(images): make a thumbnail of an image - #1
Closed
arjendevos wants to merge 1 commit into
Closed
arjendevos wants to merge 1 commit into
arjendevos wants to merge 1 commit into
Conversation
arjendevos
force-pushed
the
feat/images
branch
from
September 22, 2026 08:39
ce12357 to
5ced3c6
Compare
MakeThumbnail scales an image down to a longest side, keeping its proportions, png when the source is png so transparency survives and jpeg otherwise. Scaling is golang.org/x/image's Catmull-Rom.
arjendevos
force-pushed
the
feat/images
branch
from
September 22, 2026 08:39
5ced3c6 to
5c65f51
Compare
Contributor
Author
|
Wrong place: providers is the contract and its adapters. Image work lives in the app. |
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.
An
imagespackage withMakeThumbnail(source, longest): decode, scale down to a longest side keeping proportions, encode as png when the source was png and jpeg otherwise. Scaling isgolang.org/x/image/drawCatmull-Rom, the one new dependency. An image already small enough comes back at its own size; bytes that are not an image answerErrNotAnImage.Needed by contentpad, which stores a small copy beside every image asset; it was scaling by hand in app code, which is the wrong place for it.