mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Use random performer image if none provided
This commit is contained in:
19
pkg/api/images.go
Normal file
19
pkg/api/images.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
|
||||
"github.com/gobuffalo/packr/v2"
|
||||
)
|
||||
|
||||
var performerBox *packr.Box
|
||||
|
||||
func initialiseImages() {
|
||||
performerBox = packr.New("Performer Box", "../../static/performer")
|
||||
}
|
||||
|
||||
func getRandomPerformerImage() ([]byte, error) {
|
||||
imageFiles := performerBox.List()
|
||||
index := rand.Intn(len(imageFiles))
|
||||
return performerBox.Find(imageFiles[index])
|
||||
}
|
||||
Reference in New Issue
Block a user