Add a cache for gallery thumbnails (#496)

This commit is contained in:
bnkai
2020-05-11 10:20:08 +03:00
committed by GitHub
parent 8ba76783b0
commit bd45daacf3
36 changed files with 319 additions and 1200 deletions

View File

@@ -26,6 +26,8 @@ type Gallery struct {
UpdatedAt SQLiteTimestamp `db:"updated_at" json:"updated_at"`
}
const DefaultGthumbWidth int = 200
func (g *Gallery) GetFiles(baseURL string) []*GalleryFilesType {
var galleryFiles []*GalleryFilesType
filteredFiles, readCloser, err := g.listZipContents()
@@ -152,3 +154,11 @@ func reorder(a []*zip.File, toFirst int) []*zip.File {
}
return a
}
func (g *Gallery) ImageCount() int {
images, _, _ := g.listZipContents()
if images == nil {
return 0
}
return len(images)
}