mirror of
https://github.com/immich-app/immich.git
synced 2025-07-01 21:40:10 +02:00
fix: load original image for gifs (#10252)
This commit is contained in:
parent
fb641c74be
commit
a54e01ef2f
9 changed files with 81 additions and 11 deletions
web/src/lib/utils
|
@ -257,20 +257,20 @@ export function getAssetRatio(asset: AssetResponseDto) {
|
|||
}
|
||||
|
||||
// list of supported image extensions from https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Image_types excluding svg
|
||||
const supportedImageExtensions = new Set(['apng', 'avif', 'gif', 'jpg', 'jpeg', 'jfif', 'pjpeg', 'pjp', 'png', 'webp']);
|
||||
const supportedImageMimeTypes = new Set([
|
||||
'image/apng',
|
||||
'image/avif',
|
||||
'image/gif',
|
||||
'image/jpeg',
|
||||
'image/png',
|
||||
'image/webp',
|
||||
]);
|
||||
|
||||
/**
|
||||
* Returns true if the asset is an image supported by web browsers, false otherwise
|
||||
*/
|
||||
export function isWebCompatibleImage(asset: AssetResponseDto): boolean {
|
||||
// originalPath is undefined when public shared link has metadata option turned off
|
||||
if (!asset.originalPath) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const imgExtension = getFilenameExtension(asset.originalPath);
|
||||
|
||||
return supportedImageExtensions.has(imgExtension);
|
||||
return supportedImageMimeTypes.has(asset.originalMimeType);
|
||||
}
|
||||
|
||||
export const getAssetType = (type: AssetTypeEnum) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue