mirror of
https://github.com/immich-app/immich.git
synced 2026-03-01 11:20:12 +03:00
Compare commits
2 Commits
postgres-s
...
fix-migrat
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
99a8740f1b | ||
|
|
a781c78caf |
@@ -98,7 +98,12 @@ class AssetService {
|
|||||||
height = fetched?.height?.toDouble();
|
height = fetched?.height?.toDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
return (width: width, height: height, isFlipped: false);
|
// Check exif for orientation to determine if dimensions should be flipped
|
||||||
|
// This is important for videos where raw file dimensions may not match display dimensions
|
||||||
|
final exif = await _remoteAssetRepository.getExif(asset.id);
|
||||||
|
final isFlipped = exif?.isFlipped ?? false;
|
||||||
|
|
||||||
|
return (width: width, height: height, isFlipped: isFlipped);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<(String, String)>> getPlaces(String userId) {
|
Future<List<(String, String)>> getPlaces(String userId) {
|
||||||
|
|||||||
@@ -284,12 +284,16 @@ Future<void> _syncLocalAlbumIsIosSharedAlbum(Drift db) async {
|
|||||||
|
|
||||||
Future<void> _backfillAssetExifWidthHeight(Drift db) async {
|
Future<void> _backfillAssetExifWidthHeight(Drift db) async {
|
||||||
try {
|
try {
|
||||||
|
// Only backfill images (type = 1), not videos
|
||||||
|
// Videos have different dimension handling based on orientation/exif
|
||||||
await db.customStatement('''
|
await db.customStatement('''
|
||||||
UPDATE remote_exif_entity AS remote_exif
|
UPDATE remote_exif_entity AS remote_exif
|
||||||
SET width = asset.width,
|
SET width = asset.width,
|
||||||
height = asset.height
|
height = asset.height
|
||||||
FROM remote_asset_entity AS asset
|
FROM remote_asset_entity AS asset
|
||||||
WHERE remote_exif.asset_id = asset.id;
|
WHERE remote_exif.asset_id = asset.id
|
||||||
|
AND asset.type = 1
|
||||||
|
AND (remote_exif.width IS NULL OR remote_exif.width = 0 OR remote_exif.height IS NULL OR remote_exif.height = 0);
|
||||||
''');
|
''');
|
||||||
|
|
||||||
dPrint(() => "[MIGRATION] Successfully backfilled asset exif width and height");
|
dPrint(() => "[MIGRATION] Successfully backfilled asset exif width and height");
|
||||||
|
|||||||
@@ -118,7 +118,13 @@ abstract final class TestUtils {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static domain.RemoteAsset createRemoteAsset({required String id, int? width, int? height, String? ownerId}) {
|
static domain.RemoteAsset createRemoteAsset({
|
||||||
|
required String id,
|
||||||
|
int? width,
|
||||||
|
int? height,
|
||||||
|
String? ownerId,
|
||||||
|
String? localId,
|
||||||
|
}) {
|
||||||
return domain.RemoteAsset(
|
return domain.RemoteAsset(
|
||||||
id: id,
|
id: id,
|
||||||
checksum: 'checksum1',
|
checksum: 'checksum1',
|
||||||
@@ -132,6 +138,7 @@ abstract final class TestUtils {
|
|||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
isEdited: false,
|
isEdited: false,
|
||||||
|
localId: localId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user