mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Change thumbnail default size and resize algorithm (#336)
* Change thumbnail resize algorithm and add size parameter * Height -> Width * Change default size from 100px to 200px * Height -> width
This commit is contained in:
@@ -52,13 +52,13 @@ func (g *Gallery) GetImage(index int) []byte {
|
||||
return data
|
||||
}
|
||||
|
||||
func (g *Gallery) GetThumbnail(index int) []byte {
|
||||
func (g *Gallery) GetThumbnail(index int, width int) []byte {
|
||||
data, _ := g.readZipFile(index)
|
||||
srcImage, _, err := image.Decode(bytes.NewReader(data))
|
||||
if err != nil {
|
||||
return data
|
||||
}
|
||||
resizedImage := imaging.Resize(srcImage, 100, 0, imaging.NearestNeighbor)
|
||||
resizedImage := imaging.Resize(srcImage, width, 0, imaging.Box)
|
||||
buf := new(bytes.Buffer)
|
||||
err = jpeg.Encode(buf, resizedImage, nil)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user