stash/pkg/gallery/images.go
WithoutPants aca2c7c5f4
Images section (#813)
* Add new configuration options
* Refactor scan/clean
* Schema changes
* Add details to galleries
* Remove redundant code
* Refine thumbnail generation
* Gallery overhaul
* Don't allow modifying zip gallery images
* Show gallery card overlays
* Hide zoom slider when not in grid mode
2020-10-13 10:12:46 +11:00

30 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
}