mirror of https://github.com/stashapp/stash.git
20 lines
367 B
Go
20 lines
367 B
Go
|
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])
|
||
|
}
|