mirror of
https://github.com/immich-app/immich.git
synced 2025-01-01 08:31:59 +00:00
fix(server): Handle exposure time correctly (#1432)
This commit is contained in:
parent
bcb0056b55
commit
8b73c2bf8a
12 changed files with 27 additions and 18 deletions
|
@ -188,7 +188,7 @@ class ExifBottomSheet extends HookConsumerWidget {
|
|||
),
|
||||
),
|
||||
subtitle: Text(
|
||||
"ƒ/${exifInfo.fNumber} 1/${(1 / (exifInfo.exposureTime ?? 1)).toStringAsFixed(0)} ${exifInfo.focalLength} mm ISO${exifInfo.iso} ",
|
||||
"ƒ/${exifInfo.fNumber} ${exifInfo.exposureTime} ${exifInfo.focalLength} mm ISO${exifInfo.iso} ",
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
BIN
mobile/openapi/doc/ExifResponseDto.md
generated
BIN
mobile/openapi/doc/ExifResponseDto.md
generated
Binary file not shown.
BIN
mobile/openapi/lib/model/exif_response_dto.dart
generated
BIN
mobile/openapi/lib/model/exif_response_dto.dart
generated
Binary file not shown.
BIN
mobile/openapi/test/exif_response_dto_test.dart
generated
BIN
mobile/openapi/test/exif_response_dto_test.dart
generated
Binary file not shown.
|
@ -154,13 +154,6 @@ export class MetadataExtractionProcessor {
|
|||
return exifDate.toDate();
|
||||
};
|
||||
|
||||
const getExposureTimeDenominator = (exposureTime: string | undefined) => {
|
||||
if (!exposureTime) return null;
|
||||
|
||||
const exposureTimeSplit = exposureTime.split('/');
|
||||
return exposureTimeSplit.length === 2 ? parseInt(exposureTimeSplit[1]) : null;
|
||||
};
|
||||
|
||||
const createdAt = exifToDate(exifData?.DateTimeOriginal ?? exifData?.CreateDate ?? asset.createdAt);
|
||||
const modifyDate = exifToDate(exifData?.ModifyDate ?? asset.modifiedAt);
|
||||
const fileStats = fs.statSync(asset.originalPath);
|
||||
|
@ -174,7 +167,7 @@ export class MetadataExtractionProcessor {
|
|||
newExif.model = exifData?.Model || null;
|
||||
newExif.exifImageHeight = exifData?.ExifImageHeight || exifData?.ImageHeight || null;
|
||||
newExif.exifImageWidth = exifData?.ExifImageWidth || exifData?.ImageWidth || null;
|
||||
newExif.exposureTime = getExposureTimeDenominator(exifData?.ExposureTime);
|
||||
newExif.exposureTime = exifData?.ExposureTime || null;
|
||||
newExif.orientation = exifData?.Orientation?.toString() || null;
|
||||
newExif.dateTimeOriginal = createdAt;
|
||||
newExif.modifyDate = modifyDate;
|
||||
|
|
|
@ -3207,7 +3207,7 @@
|
|||
"default": null
|
||||
},
|
||||
"exposureTime": {
|
||||
"type": "number",
|
||||
"type": "string",
|
||||
"nullable": true,
|
||||
"default": null
|
||||
},
|
||||
|
|
|
@ -19,7 +19,7 @@ export class ExifResponseDto {
|
|||
fNumber?: number | null = null;
|
||||
focalLength?: number | null = null;
|
||||
iso?: number | null = null;
|
||||
exposureTime?: number | null = null;
|
||||
exposureTime?: string | null = null;
|
||||
latitude?: number | null = null;
|
||||
longitude?: number | null = null;
|
||||
city?: string | null = null;
|
||||
|
|
|
@ -22,7 +22,7 @@ const assetInfo: ExifResponseDto = {
|
|||
fNumber: 100,
|
||||
focalLength: 100,
|
||||
iso: 100,
|
||||
exposureTime: 100,
|
||||
exposureTime: '1/16',
|
||||
latitude: 100,
|
||||
longitude: 100,
|
||||
city: 'city',
|
||||
|
@ -349,7 +349,7 @@ export const sharedLinkStub = {
|
|||
fNumber: 100,
|
||||
focalLength: 100,
|
||||
iso: 100,
|
||||
exposureTime: 100,
|
||||
exposureTime: '1/16',
|
||||
fps: 100,
|
||||
asset: null as any,
|
||||
exifTextSearchableColumn: '',
|
||||
|
|
|
@ -72,8 +72,8 @@ export class ExifEntity {
|
|||
@Column({ type: 'integer', nullable: true })
|
||||
iso!: number | null;
|
||||
|
||||
@Column({ type: 'float', nullable: true })
|
||||
exposureTime!: number | null;
|
||||
@Column({ type: 'varchar', nullable: true })
|
||||
exposureTime!: string | null;
|
||||
|
||||
/* Video info */
|
||||
@Column({ type: 'float8', nullable: true })
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class AlterExifExposureTimeToString1674757936889 implements MigrationInterface {
|
||||
name = 'AlterExifExposureTimeToString1674757936889'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "exif" DROP COLUMN "exposureTime"`);
|
||||
await queryRunner.query(`ALTER TABLE "exif" ADD "exposureTime" character varying`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "exif" DROP COLUMN "exposureTime"`);
|
||||
await queryRunner.query(`ALTER TABLE "exif" ADD "exposureTime" double precision`);
|
||||
}
|
||||
|
||||
}
|
4
web/src/api/open-api/api.ts
generated
4
web/src/api/open-api/api.ts
generated
|
@ -1116,10 +1116,10 @@ export interface ExifResponseDto {
|
|||
'iso'?: number | null;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @type {string}
|
||||
* @memberof ExifResponseDto
|
||||
*/
|
||||
'exposureTime'?: number | null;
|
||||
'exposureTime'?: string | null;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
|
|
|
@ -152,7 +152,7 @@
|
|||
<p>{`ƒ/${asset.exifInfo.fNumber.toLocaleString(locale)}` || ''}</p>
|
||||
|
||||
{#if asset.exifInfo.exposureTime}
|
||||
<p>{`1/${asset.exifInfo.exposureTime}`}</p>
|
||||
<p>{`${asset.exifInfo.exposureTime}`}</p>
|
||||
{/if}
|
||||
|
||||
{#if asset.exifInfo.focalLength}
|
||||
|
|
Loading…
Reference in a new issue