Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var SupportedImageExts = map[string]string{
".png": "image/png",
".jpg": "image/jpeg",
".jpeg": "image/jpeg",
".gif": "image/gif",
".webp": "image/webp",
}
SupportedImageExts maps file extensions to MIME types.
Functions ¶
func CompressImage ¶
CompressImage attempts to reduce image size by re-encoding as JPEG at progressively lower quality. Returns the (possibly compressed) bytes and the resulting media type. Falls back to original bytes if compression fails.
func HumanFileSize ¶
HumanFileSize returns a human-readable size string.
func IsImageFile ¶
IsImageFile returns true if path has a supported image extension.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.