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)
| 130 | // files, good enough for thumbnails). Single source of truth shared |
| 131 | // by the upload pipeline and tests. |
| 132 | func 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). |
no outgoing calls