1
0
mirror of https://github.com/immich-app/immich.git synced 2025-07-17 15:47:54 +02:00

feat(server): separate quality for thumbnail and preview images (#13006)

* allow different thumbnail and preview quality, better config structure

* update web and api

* wording

* remove empty line?
This commit is contained in:
Mert
2024-09-28 02:01:04 -04:00
committed by GitHub
parent 4248594ac5
commit 995f0fda47
17 changed files with 369 additions and 198 deletions

View File

@ -15,64 +15,42 @@ class SystemConfigImageDto {
SystemConfigImageDto({
required this.colorspace,
required this.extractEmbedded,
required this.previewFormat,
required this.previewSize,
required this.quality,
required this.thumbnailFormat,
required this.thumbnailSize,
required this.preview,
required this.thumbnail,
});
Colorspace colorspace;
bool extractEmbedded;
ImageFormat previewFormat;
SystemConfigGeneratedImageDto preview;
/// Minimum value: 1
int previewSize;
/// Minimum value: 1
/// Maximum value: 100
int quality;
ImageFormat thumbnailFormat;
/// Minimum value: 1
int thumbnailSize;
SystemConfigGeneratedImageDto thumbnail;
@override
bool operator ==(Object other) => identical(this, other) || other is SystemConfigImageDto &&
other.colorspace == colorspace &&
other.extractEmbedded == extractEmbedded &&
other.previewFormat == previewFormat &&
other.previewSize == previewSize &&
other.quality == quality &&
other.thumbnailFormat == thumbnailFormat &&
other.thumbnailSize == thumbnailSize;
other.preview == preview &&
other.thumbnail == thumbnail;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(colorspace.hashCode) +
(extractEmbedded.hashCode) +
(previewFormat.hashCode) +
(previewSize.hashCode) +
(quality.hashCode) +
(thumbnailFormat.hashCode) +
(thumbnailSize.hashCode);
(preview.hashCode) +
(thumbnail.hashCode);
@override
String toString() => 'SystemConfigImageDto[colorspace=$colorspace, extractEmbedded=$extractEmbedded, previewFormat=$previewFormat, previewSize=$previewSize, quality=$quality, thumbnailFormat=$thumbnailFormat, thumbnailSize=$thumbnailSize]';
String toString() => 'SystemConfigImageDto[colorspace=$colorspace, extractEmbedded=$extractEmbedded, preview=$preview, thumbnail=$thumbnail]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'colorspace'] = this.colorspace;
json[r'extractEmbedded'] = this.extractEmbedded;
json[r'previewFormat'] = this.previewFormat;
json[r'previewSize'] = this.previewSize;
json[r'quality'] = this.quality;
json[r'thumbnailFormat'] = this.thumbnailFormat;
json[r'thumbnailSize'] = this.thumbnailSize;
json[r'preview'] = this.preview;
json[r'thumbnail'] = this.thumbnail;
return json;
}
@ -87,11 +65,8 @@ class SystemConfigImageDto {
return SystemConfigImageDto(
colorspace: Colorspace.fromJson(json[r'colorspace'])!,
extractEmbedded: mapValueOfType<bool>(json, r'extractEmbedded')!,
previewFormat: ImageFormat.fromJson(json[r'previewFormat'])!,
previewSize: mapValueOfType<int>(json, r'previewSize')!,
quality: mapValueOfType<int>(json, r'quality')!,
thumbnailFormat: ImageFormat.fromJson(json[r'thumbnailFormat'])!,
thumbnailSize: mapValueOfType<int>(json, r'thumbnailSize')!,
preview: SystemConfigGeneratedImageDto.fromJson(json[r'preview'])!,
thumbnail: SystemConfigGeneratedImageDto.fromJson(json[r'thumbnail'])!,
);
}
return null;
@ -141,11 +116,8 @@ class SystemConfigImageDto {
static const requiredKeys = <String>{
'colorspace',
'extractEmbedded',
'previewFormat',
'previewSize',
'quality',
'thumbnailFormat',
'thumbnailSize',
'preview',
'thumbnail',
};
}