2023-08-08 09:39:51 -05:00
|
|
|
<script lang="ts">
|
2024-04-07 12:44:34 -04:00
|
|
|
import { Colorspace, ImageFormat, type SystemConfigDto } from '@immich/sdk';
|
2023-08-08 09:39:51 -05:00
|
|
|
import { isEqual } from 'lodash-es';
|
2024-01-20 13:47:41 -05:00
|
|
|
import { fade } from 'svelte/transition';
|
2024-07-10 15:57:18 +02:00
|
|
|
import type { SettingsResetEvent, SettingsSaveEvent } from '../admin-settings';
|
2024-02-22 15:36:14 +01:00
|
|
|
import SettingSelect from '$lib/components/shared-components/settings/setting-select.svelte';
|
|
|
|
|
|
|
|
|
|
import SettingSwitch from '$lib/components/shared-components/settings/setting-switch.svelte';
|
|
|
|
|
import SettingButtonsRow from '$lib/components/shared-components/settings/setting-buttons-row.svelte';
|
|
|
|
|
import SettingInputField, {
|
|
|
|
|
SettingInputFieldType,
|
|
|
|
|
} from '$lib/components/shared-components/settings/setting-input-field.svelte';
|
2024-06-04 21:53:00 +02:00
|
|
|
import { t } from 'svelte-i18n';
|
2023-08-08 09:39:51 -05:00
|
|
|
|
2024-01-12 18:44:11 +01:00
|
|
|
export let savedConfig: SystemConfigDto;
|
|
|
|
|
export let defaultConfig: SystemConfigDto;
|
|
|
|
|
export let config: SystemConfigDto; // this is the config that is being edited
|
2023-08-25 19:44:52 +02:00
|
|
|
export let disabled = false;
|
2024-07-10 15:57:18 +02:00
|
|
|
export let onReset: SettingsResetEvent;
|
|
|
|
|
export let onSave: SettingsSaveEvent;
|
2023-08-08 09:39:51 -05:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<div>
|
2024-01-12 18:44:11 +01:00
|
|
|
<div in:fade={{ duration: 500 }}>
|
|
|
|
|
<form autocomplete="off" on:submit|preventDefault>
|
|
|
|
|
<div class="ml-4 mt-4 flex flex-col gap-4">
|
2024-04-07 12:44:34 -04:00
|
|
|
<SettingSelect
|
2024-06-14 07:32:41 +00:00
|
|
|
label={$t('admin.image_thumbnail_format')}
|
2024-06-04 21:53:00 +02:00
|
|
|
desc={$t('admin.image_format_description')}
|
2024-04-07 12:44:34 -04:00
|
|
|
bind:value={config.image.thumbnailFormat}
|
|
|
|
|
options={[
|
|
|
|
|
{ value: ImageFormat.Jpeg, text: 'JPEG' },
|
|
|
|
|
{ value: ImageFormat.Webp, text: 'WebP' },
|
|
|
|
|
]}
|
|
|
|
|
name="format"
|
|
|
|
|
isEdited={config.image.thumbnailFormat !== savedConfig.image.thumbnailFormat}
|
|
|
|
|
{disabled}
|
|
|
|
|
/>
|
|
|
|
|
|
2024-01-12 18:44:11 +01:00
|
|
|
<SettingSelect
|
2024-06-14 07:32:41 +00:00
|
|
|
label={$t('admin.image_thumbnail_resolution')}
|
2024-06-04 21:53:00 +02:00
|
|
|
desc={$t('admin.image_thumbnail_resolution_description')}
|
2024-01-12 18:44:11 +01:00
|
|
|
number
|
2024-04-02 00:56:56 -04:00
|
|
|
bind:value={config.image.thumbnailSize}
|
2024-01-12 18:44:11 +01:00
|
|
|
options={[
|
|
|
|
|
{ value: 1080, text: '1080p' },
|
|
|
|
|
{ value: 720, text: '720p' },
|
|
|
|
|
{ value: 480, text: '480p' },
|
|
|
|
|
{ value: 250, text: '250p' },
|
|
|
|
|
{ value: 200, text: '200p' },
|
|
|
|
|
]}
|
|
|
|
|
name="resolution"
|
2024-04-02 00:56:56 -04:00
|
|
|
isEdited={config.image.thumbnailSize !== savedConfig.image.thumbnailSize}
|
2024-01-12 18:44:11 +01:00
|
|
|
{disabled}
|
2024-04-07 12:44:34 -04:00
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<SettingSelect
|
2024-06-14 07:32:41 +00:00
|
|
|
label={$t('admin.image_preview_format')}
|
2024-06-04 21:53:00 +02:00
|
|
|
desc={$t('admin.image_format_description')}
|
2024-04-07 12:44:34 -04:00
|
|
|
bind:value={config.image.previewFormat}
|
|
|
|
|
options={[
|
|
|
|
|
{ value: ImageFormat.Jpeg, text: 'JPEG' },
|
|
|
|
|
{ value: ImageFormat.Webp, text: 'WebP' },
|
|
|
|
|
]}
|
|
|
|
|
name="format"
|
|
|
|
|
isEdited={config.image.previewFormat !== savedConfig.image.previewFormat}
|
|
|
|
|
{disabled}
|
2024-01-12 18:44:11 +01:00
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<SettingSelect
|
2024-06-14 07:32:41 +00:00
|
|
|
label={$t('admin.image_preview_resolution')}
|
2024-06-04 21:53:00 +02:00
|
|
|
desc={$t('admin.image_preview_resolution_description')}
|
2024-01-12 18:44:11 +01:00
|
|
|
number
|
2024-04-02 00:56:56 -04:00
|
|
|
bind:value={config.image.previewSize}
|
2024-01-12 18:44:11 +01:00
|
|
|
options={[
|
|
|
|
|
{ value: 2160, text: '4K' },
|
|
|
|
|
{ value: 1440, text: '1440p' },
|
|
|
|
|
{ value: 1080, text: '1080p' },
|
|
|
|
|
{ value: 720, text: '720p' },
|
|
|
|
|
]}
|
|
|
|
|
name="resolution"
|
2024-04-02 00:56:56 -04:00
|
|
|
isEdited={config.image.previewSize !== savedConfig.image.previewSize}
|
2024-01-12 18:44:11 +01:00
|
|
|
{disabled}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<SettingInputField
|
|
|
|
|
inputType={SettingInputFieldType.NUMBER}
|
2024-06-14 07:32:41 +00:00
|
|
|
label={$t('admin.image_quality')}
|
2024-06-04 21:53:00 +02:00
|
|
|
desc={$t('admin.image_quality_description')}
|
2024-04-02 00:56:56 -04:00
|
|
|
bind:value={config.image.quality}
|
|
|
|
|
isEdited={config.image.quality !== savedConfig.image.quality}
|
2024-04-06 20:59:00 -04:00
|
|
|
{disabled}
|
2024-01-12 18:44:11 +01:00
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<SettingSwitch
|
2024-06-14 07:32:41 +00:00
|
|
|
title={$t('admin.image_prefer_wide_gamut')}
|
2024-06-04 21:53:00 +02:00
|
|
|
subtitle={$t('admin.image_prefer_wide_gamut_setting_description')}
|
2024-04-02 00:56:56 -04:00
|
|
|
checked={config.image.colorspace === Colorspace.P3}
|
2024-09-21 00:24:46 +02:00
|
|
|
onToggle={(isChecked) => (config.image.colorspace = isChecked ? Colorspace.P3 : Colorspace.Srgb)}
|
2024-04-02 00:56:56 -04:00
|
|
|
isEdited={config.image.colorspace !== savedConfig.image.colorspace}
|
2024-04-06 20:59:00 -04:00
|
|
|
{disabled}
|
2024-01-12 18:44:11 +01:00
|
|
|
/>
|
2024-04-19 11:50:13 -04:00
|
|
|
|
|
|
|
|
<SettingSwitch
|
2024-06-14 07:32:41 +00:00
|
|
|
title={$t('admin.image_prefer_embedded_preview')}
|
2024-06-04 21:53:00 +02:00
|
|
|
subtitle={$t('admin.image_prefer_embedded_preview_setting_description')}
|
2024-04-19 11:50:13 -04:00
|
|
|
checked={config.image.extractEmbedded}
|
2024-09-21 00:24:46 +02:00
|
|
|
onToggle={() => (config.image.extractEmbedded = !config.image.extractEmbedded)}
|
2024-04-19 11:50:13 -04:00
|
|
|
isEdited={config.image.extractEmbedded !== savedConfig.image.extractEmbedded}
|
|
|
|
|
{disabled}
|
|
|
|
|
/>
|
2024-01-12 18:44:11 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="ml-4">
|
|
|
|
|
<SettingButtonsRow
|
2024-07-10 15:57:18 +02:00
|
|
|
onReset={(options) => onReset({ ...options, configKeys: ['image'] })}
|
|
|
|
|
onSave={() => onSave({ image: config.image })}
|
2024-04-07 12:43:40 -04:00
|
|
|
showResetToDefault={!isEqual(savedConfig.image, defaultConfig.image)}
|
2024-01-12 18:44:11 +01:00
|
|
|
{disabled}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
2023-08-08 09:39:51 -05:00
|
|
|
</div>
|