mirror of https://github.com/stashapp/stash.git
31 lines
670 B
Go
31 lines
670 B
Go
package gallery
|
|
|
|
import (
|
|
"github.com/stashapp/stash/pkg/api/urlbuilders"
|
|
"github.com/stashapp/stash/pkg/models"
|
|
)
|
|
|
|
func GetFiles(g *models.Gallery, baseURL string) []*models.GalleryFilesType {
|
|
var galleryFiles []*models.GalleryFilesType
|
|
|
|
qb := models.NewImageQueryBuilder()
|
|
images, err := qb.FindByGalleryID(g.ID)
|
|
if err != nil {
|
|
return nil
|
|
}
|
|
|
|
for i, img := range images {
|
|
builder := urlbuilders.NewImageURLBuilder(baseURL, img.ID)
|
|
imageURL := builder.GetImageURL()
|
|
|
|
galleryFile := models.GalleryFilesType{
|
|
Index: i,
|
|
Name: &img.Title.String,
|
|
Path: &imageURL,
|
|
}
|
|
galleryFiles = append(galleryFiles, &galleryFile)
|
|
}
|
|
|
|
return galleryFiles
|
|
}
|