mirror of
https://github.com/immich-app/immich.git
synced 2024-12-19 00:32:49 +02:00
0d0866d5d9
* Add API service * Added service, provider * merge main * update pubspec * styling * dev: add person search result page * dev: display person asset on page * dev: add rename form * style form * dev: mechanism to add name to faces * styling * fix bad merge * update api * test * revert * Add header widget * change name * show all people page * fix test * pr feedback * Add name to app bar * feedback * styling
66 lines
1.7 KiB
Dart
66 lines
1.7 KiB
Dart
import 'package:immich_mobile/shared/models/album.dart';
|
|
import 'package:immich_mobile/shared/models/asset.dart';
|
|
import 'package:immich_mobile/shared/models/store.dart';
|
|
import 'package:openapi/api.dart';
|
|
|
|
String getThumbnailUrl(
|
|
final Asset asset, {
|
|
ThumbnailFormat type = ThumbnailFormat.WEBP,
|
|
}) {
|
|
return _getThumbnailUrl(asset.remoteId!, type: type);
|
|
}
|
|
|
|
String getThumbnailCacheKey(
|
|
final Asset asset, {
|
|
ThumbnailFormat type = ThumbnailFormat.WEBP,
|
|
}) {
|
|
return _getThumbnailCacheKey(asset.remoteId!, type);
|
|
}
|
|
|
|
String _getThumbnailCacheKey(final String id, final ThumbnailFormat type) {
|
|
if (type == ThumbnailFormat.WEBP) {
|
|
return 'thumbnail-image-$id';
|
|
} else {
|
|
return '${id}_previewStage';
|
|
}
|
|
}
|
|
|
|
String getAlbumThumbnailUrl(
|
|
final Album album, {
|
|
ThumbnailFormat type = ThumbnailFormat.WEBP,
|
|
}) {
|
|
if (album.thumbnail.value?.remoteId == null) {
|
|
return '';
|
|
}
|
|
return _getThumbnailUrl(album.thumbnail.value!.remoteId!, type: type);
|
|
}
|
|
|
|
String getAlbumThumbNailCacheKey(
|
|
final Album album, {
|
|
ThumbnailFormat type = ThumbnailFormat.WEBP,
|
|
}) {
|
|
if (album.thumbnail.value?.remoteId == null) {
|
|
return '';
|
|
}
|
|
return _getThumbnailCacheKey(album.thumbnail.value!.remoteId!, type);
|
|
}
|
|
|
|
String getImageUrl(final Asset asset) {
|
|
return '${Store.get(StoreKey.serverEndpoint)}/asset/file/${asset.remoteId}?isThumb=false';
|
|
}
|
|
|
|
String getImageCacheKey(final Asset asset) {
|
|
return '${asset.id}_fullStage';
|
|
}
|
|
|
|
String _getThumbnailUrl(
|
|
final String id, {
|
|
ThumbnailFormat type = ThumbnailFormat.WEBP,
|
|
}) {
|
|
return '${Store.get(StoreKey.serverEndpoint)}/asset/thumbnail/$id?format=${type.value}';
|
|
}
|
|
|
|
String getFaceThumbnailUrl(final String personId) {
|
|
return '${Store.get(StoreKey.serverEndpoint)}/person/$personId/thumbnail';
|
|
}
|