Harden image processing, improve image quality

This commit is contained in:
2026-04-20 18:10:48 +04:00
parent 4f55f26851
commit ec31d1a59b
7 changed files with 193 additions and 49 deletions

View File

@@ -1,6 +1,7 @@
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { service } from '@ember/service';
import { action } from '@ember/object';
import { task } from 'ember-concurrency';
import Icon from '#components/icon';
import { on } from '@ember/modifier';
@@ -14,6 +15,7 @@ const THUMBNAIL_QUALITY = 0.9;
export default class PlacePhotoItem extends Component {
@service blossom;
@service imageProcessor;
@service toast;
@tracked thumbnailUrl = '';
@tracked error = '';
@@ -34,6 +36,13 @@ export default class PlacePhotoItem extends Component {
}
}
@action
showErrorToast() {
if (this.error) {
this.toast.show(this.error);
}
}
uploadTask = task(async (file) => {
this.error = '';
try {
@@ -105,9 +114,14 @@ export default class PlacePhotoItem extends Component {
{{/if}}
{{#if this.error}}
<div class="photo-item-overlay error-overlay" title={{this.error}}>
<button
type="button"
class="photo-item-overlay error-overlay"
title={{this.error}}
{{on "click" this.showErrorToast}}
>
<Icon @name="alert-circle" @size={{24}} @color="white" />
</div>
</button>
{{/if}}
{{#if this.isUploaded}}