Skip to content
Snippets Groups Projects
Commit 61c52917 authored by Ophestra's avatar Ophestra
Browse files

export MakePreview

parent 1a987c9e
Branches
Tags v1.4.0
No related merge requests found
......@@ -29,6 +29,11 @@ type Image struct {
CommentaryTranslation string `json:"commentary_translation"`
}
// MakePreview compresses an image.Image to preview-size.
func MakePreview(img image.Image) image.Image {
return resize.Thumbnail(256, 256, img, resize.Bilinear)
}
// Images returns a slice of image hashes.
func (s *Store) Images() []string {
var images []string
......@@ -236,7 +241,7 @@ func (s *Store) ImageAdd(data []byte, flake string) Image {
log.Warnf("Error decoding upload %s, %s", info.Hash, err)
return Image{}
} else {
img = resize.Thumbnail(256, 256, i, resize.Bilinear)
img = MakePreview(i)
info.Type = format
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment