You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-08-09 23:17:29 +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:
1
mobile/openapi/lib/api.dart
generated
1
mobile/openapi/lib/api.dart
generated
@ -229,6 +229,7 @@ part 'model/stack_update_dto.dart';
|
||||
part 'model/system_config_dto.dart';
|
||||
part 'model/system_config_f_fmpeg_dto.dart';
|
||||
part 'model/system_config_faces_dto.dart';
|
||||
part 'model/system_config_generated_image_dto.dart';
|
||||
part 'model/system_config_image_dto.dart';
|
||||
part 'model/system_config_job_dto.dart';
|
||||
part 'model/system_config_library_dto.dart';
|
||||
|
2
mobile/openapi/lib/api_client.dart
generated
2
mobile/openapi/lib/api_client.dart
generated
@ -512,6 +512,8 @@ class ApiClient {
|
||||
return SystemConfigFFmpegDto.fromJson(value);
|
||||
case 'SystemConfigFacesDto':
|
||||
return SystemConfigFacesDto.fromJson(value);
|
||||
case 'SystemConfigGeneratedImageDto':
|
||||
return SystemConfigGeneratedImageDto.fromJson(value);
|
||||
case 'SystemConfigImageDto':
|
||||
return SystemConfigImageDto.fromJson(value);
|
||||
case 'SystemConfigJobDto':
|
||||
|
118
mobile/openapi/lib/model/system_config_generated_image_dto.dart
generated
Normal file
118
mobile/openapi/lib/model/system_config_generated_image_dto.dart
generated
Normal file
@ -0,0 +1,118 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.18
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
class SystemConfigGeneratedImageDto {
|
||||
/// Returns a new [SystemConfigGeneratedImageDto] instance.
|
||||
SystemConfigGeneratedImageDto({
|
||||
required this.format,
|
||||
required this.quality,
|
||||
required this.size,
|
||||
});
|
||||
|
||||
ImageFormat format;
|
||||
|
||||
/// Minimum value: 1
|
||||
/// Maximum value: 100
|
||||
int quality;
|
||||
|
||||
/// Minimum value: 1
|
||||
int size;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is SystemConfigGeneratedImageDto &&
|
||||
other.format == format &&
|
||||
other.quality == quality &&
|
||||
other.size == size;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(format.hashCode) +
|
||||
(quality.hashCode) +
|
||||
(size.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'SystemConfigGeneratedImageDto[format=$format, quality=$quality, size=$size]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
json[r'format'] = this.format;
|
||||
json[r'quality'] = this.quality;
|
||||
json[r'size'] = this.size;
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [SystemConfigGeneratedImageDto] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static SystemConfigGeneratedImageDto? fromJson(dynamic value) {
|
||||
upgradeDto(value, "SystemConfigGeneratedImageDto");
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
return SystemConfigGeneratedImageDto(
|
||||
format: ImageFormat.fromJson(json[r'format'])!,
|
||||
quality: mapValueOfType<int>(json, r'quality')!,
|
||||
size: mapValueOfType<int>(json, r'size')!,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<SystemConfigGeneratedImageDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <SystemConfigGeneratedImageDto>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = SystemConfigGeneratedImageDto.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, SystemConfigGeneratedImageDto> mapFromJson(dynamic json) {
|
||||
final map = <String, SystemConfigGeneratedImageDto>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = SystemConfigGeneratedImageDto.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of SystemConfigGeneratedImageDto-objects as value to a dart map
|
||||
static Map<String, List<SystemConfigGeneratedImageDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<SystemConfigGeneratedImageDto>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = SystemConfigGeneratedImageDto.listFromJson(entry.value, growable: growable,);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
'format',
|
||||
'quality',
|
||||
'size',
|
||||
};
|
||||
}
|
||||
|
@ -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',
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user