fix(web): asset refresh (#21788)

This commit is contained in:
Jason Rasmussen 2025-09-10 16:08:15 -04:00 committed by GitHub
parent 7e377d3e42
commit 761ac074c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 56 additions and 82 deletions

View file

@ -34,6 +34,7 @@ import {
type AssetResponseDto,
type AssetTypeEnum,
type DownloadInfoDto,
type ExifResponseDto,
type StackResponseDto,
type UserPreferencesResponseDto,
type UserResponseDto,
@ -328,6 +329,15 @@ export function isFlipped(orientation?: string | null) {
return value && (isRotated270CW(value) || isRotated90CW(value));
}
export const getDimensions = (exifInfo: ExifResponseDto) => {
const { exifImageWidth: width, exifImageHeight: height } = exifInfo;
if (isFlipped(exifInfo.orientation)) {
return { width: height, height: width };
}
return { width, height };
};
export function getFileSize(asset: AssetResponseDto, maxPrecision = 4): string {
const size = asset.exifInfo?.fileSizeInByte || 0;
return size > 0 ? getByteUnitString(size, undefined, maxPrecision) : 'Invalid Data';