Documentation
¶
Index ¶
- Variables
- func CenterResize(src image.Image, width int, height int) (image.Image, error)
- func CreateThumbnail(i model.Item) (model.Image, error)
- func GetThumbnailPath(mediaPath string) string
- func IsThumbnail(imgPath string) bool
- func LoadImage(imgPath string) (model.Image, error)
- func SaveImage(img image.Image, encoding string, path string) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ThumbnailWidth = 300 ThumbnailHeight = 300 ThumbnailSuffix = "thumb" )
Functions ¶
func CenterResize ¶
CenterResize by:
- Finding the smallest dimension (width or height)
- Scaling the image down while keeping aspect ratio
- Cropping excess from largest dimension (width or height) by cutting an equal amount on both sides, leaving the image centered
4. Store the resized version with suffix
func CreateThumbnail ¶
CreateThumbnail by looking at the image MIMEtype and then take appropriate actions to create it.
For images, scale the image to 300x300px without changing the ratio by first scaling it by the smallest side too 300px, then cropping/trimming the excess of the longest side
func GetThumbnailPath ¶
func IsThumbnail ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.