MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / ThumbnailFormat

Function ThumbnailFormat

internal/attachments/processor.go:132–137  ·  view source on GitHub ↗

Format-policy helpers — shared between the pure-Go and libvips backends. These are intentionally NOT inside a build-tagged file so they compile under every build tag. Both backends produce PNG for PNG inputs (preserves alpha) and JPEG for everything else. ThumbnailFormat picks the best output format

(inputFormat string)

Source from the content-addressed store, hash-verified

130// files, good enough for thumbnails). Single source of truth shared
131// by the upload pipeline and tests.
132func ThumbnailFormat(inputFormat string) string {
133 if inputFormat == "png" {
134 return "png"
135 }
136 return "jpeg"
137}
138
139// ThumbnailMime returns the canonical MIME type for a thumbnail
140// encoded in `format` (paired with ThumbnailFormat above).

Callers 3

deriveThumbnailsMethod · 0.92
TestThumbnailFormatFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestThumbnailFormatFunction · 0.68