Render thumbnails at correct aspect ratio

This commit is contained in:
2026-05-17 12:22:57 +02:00
parent 93a87088db
commit 0d28c4172c
3 changed files with 13 additions and 2 deletions

View File

@@ -7,10 +7,11 @@ component ImagePreview inherits Rectangle {
in property <length> size: 32px;
width: size;
height: size;
clip: true;
Image {
width: 100%;
height: 100%;
width: preview.ratio < 1.0 ? size : size * preview.ratio;
height: preview.ratio > 1.0 ? size : size / preview.ratio;
source: preview.image;
}

View File

@@ -6,7 +6,13 @@ export enum PreviewKind {
export struct ImagePreview {
asset_id: string,
// Thumbnail/thumbhash/etc
image: image,
// Image aspect ratio. (width/height)
ratio: float,
kind: PreviewKind,
}