mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
feat(mobile): enable zoom of preview images & reuse cached thumbnails (#1049)
This commit is contained in:
parent
99854e90be
commit
83c7434eb5
6 changed files with 37 additions and 17 deletions
|
|
@ -10,6 +10,19 @@ String getThumbnailUrl(
|
|||
return _getThumbnailUrl(asset.id, type: type);
|
||||
}
|
||||
|
||||
String getThumbnailCacheKey(final AssetResponseDto asset,
|
||||
{ThumbnailFormat type = ThumbnailFormat.WEBP}) {
|
||||
return _getThumbnailCacheKey(asset.id, type);
|
||||
}
|
||||
|
||||
String _getThumbnailCacheKey(final String id, final ThumbnailFormat type) {
|
||||
if (type == ThumbnailFormat.WEBP) {
|
||||
return 'thumbnail-image-$id';
|
||||
} else {
|
||||
return '${id}_previewStage';
|
||||
}
|
||||
}
|
||||
|
||||
String getAlbumThumbnailUrl(
|
||||
final AlbumResponseDto album, {
|
||||
ThumbnailFormat type = ThumbnailFormat.WEBP,
|
||||
|
|
@ -20,11 +33,25 @@ String getAlbumThumbnailUrl(
|
|||
return _getThumbnailUrl(album.albumThumbnailAssetId!, type: type);
|
||||
}
|
||||
|
||||
String getAlbumThumbNailCacheKey(
|
||||
final AlbumResponseDto album, {
|
||||
ThumbnailFormat type = ThumbnailFormat.WEBP,
|
||||
}) {
|
||||
if (album.albumThumbnailAssetId == null) {
|
||||
return '';
|
||||
}
|
||||
return _getThumbnailCacheKey(album.albumThumbnailAssetId!, type);
|
||||
}
|
||||
|
||||
String getImageUrl(final AssetResponseDto asset) {
|
||||
final box = Hive.box(userInfoBox);
|
||||
return '${box.get(serverEndpointKey)}/asset/file/${asset.id}?isThumb=false';
|
||||
}
|
||||
|
||||
String getImageCacheKey(final AssetResponseDto asset) {
|
||||
return '${asset.id}_fullStage';
|
||||
}
|
||||
|
||||
String _getThumbnailUrl(
|
||||
final String id, {
|
||||
ThumbnailFormat type = ThumbnailFormat.WEBP,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue