feat(photos): add square medium variant for sharp grid thumbnails
This commit is contained in:
@@ -61,13 +61,27 @@ func (s *Service) List(ctx context.Context, userID string) ([]models.Album, erro
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// attachCover fills CoverThumbURL from the signed thumbnail URL, when present.
|
||||
// attachCover fills CoverThumbURL and CoverMediumURL from signed URLs. The
|
||||
// medium URL falls back to the thumbnail while the medium variant is not ready,
|
||||
// so a cover URL suitable for large display is always present when a cover is
|
||||
// set.
|
||||
func (s *Service) attachCover(ctx context.Context, a *models.Album) {
|
||||
if s.storage == nil || a == nil || a.CoverThumbKey == "" {
|
||||
if s.storage == nil || a == nil {
|
||||
return
|
||||
}
|
||||
if url, err := s.storage.URL(ctx, a.CoverThumbKey); err == nil {
|
||||
a.CoverThumbURL = url
|
||||
if a.CoverThumbKey != "" {
|
||||
if url, err := s.storage.URL(ctx, a.CoverThumbKey); err == nil {
|
||||
a.CoverThumbURL = url
|
||||
}
|
||||
}
|
||||
key := a.CoverMediumKey
|
||||
if key == "" {
|
||||
key = a.CoverThumbKey
|
||||
}
|
||||
if key != "" {
|
||||
if url, err := s.storage.URL(ctx, key); err == nil {
|
||||
a.CoverMediumURL = url
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user