mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-12 21:08:46 +00:00
브라우저에서 HEIF 이미지를 제대로 표현하지 못하던 버그 수정 2
This commit is contained in:
@@ -32,24 +32,22 @@
|
||||
untrack(() => {
|
||||
isDownloaded = true;
|
||||
|
||||
if ($info.contentType.startsWith("image")) {
|
||||
contentType = "image";
|
||||
} else if ($info.contentType.startsWith("video")) {
|
||||
contentType = "video";
|
||||
}
|
||||
|
||||
requestFileDownload(data.id, $info.contentIv, $info.dataKey).then(async (res) => {
|
||||
content = new Blob([res], { type: $info.contentType });
|
||||
if (content.type === "image/heic" || content.type === "image/heif") {
|
||||
contentUrl = URL.createObjectURL(
|
||||
(await heic2any({ blob: content, toType: "image/jpeg" })) as Blob,
|
||||
);
|
||||
} else {
|
||||
} else if (contentType) {
|
||||
contentUrl = URL.createObjectURL(content);
|
||||
}
|
||||
|
||||
if (content.type.startsWith("image")) {
|
||||
contentType = "image";
|
||||
} else if (content.type.startsWith("video")) {
|
||||
contentType = "video";
|
||||
}
|
||||
|
||||
if (!contentType) {
|
||||
FileSaver.saveAs(new Blob([res], { type: $info.contentType }), $info.name);
|
||||
} else {
|
||||
FileSaver.saveAs(content, $info.name);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -80,18 +78,16 @@
|
||||
</div>
|
||||
{/snippet}
|
||||
|
||||
{#if contentType === "image"}
|
||||
{#if $info && content}
|
||||
{@const src = URL.createObjectURL(new Blob([content], { type: $info.contentType }))}
|
||||
<img {src} alt={$info.name} />
|
||||
{#if $info && contentType === "image"}
|
||||
{#if contentUrl}
|
||||
<img src={contentUrl} alt={$info.name} />
|
||||
{:else}
|
||||
{@render viewerLoading("이미지를 불러오고 있어요.")}
|
||||
{/if}
|
||||
{:else if contentType === "video"}
|
||||
{#if $info && content}
|
||||
{@const src = URL.createObjectURL(new Blob([content], { type: $info.contentType }))}
|
||||
{#if contentUrl}
|
||||
<!-- svelte-ignore a11y_media_has_caption -->
|
||||
<video {src} controls></video>
|
||||
<video src={contentUrl} controls></video>
|
||||
{:else}
|
||||
{@render viewerLoading("비디오를 불러오고 있어요.")}
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user