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(() => {
|
untrack(() => {
|
||||||
isDownloaded = true;
|
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) => {
|
requestFileDownload(data.id, $info.contentIv, $info.dataKey).then(async (res) => {
|
||||||
content = new Blob([res], { type: $info.contentType });
|
content = new Blob([res], { type: $info.contentType });
|
||||||
if (content.type === "image/heic" || content.type === "image/heif") {
|
if (content.type === "image/heic" || content.type === "image/heif") {
|
||||||
contentUrl = URL.createObjectURL(
|
contentUrl = URL.createObjectURL(
|
||||||
(await heic2any({ blob: content, toType: "image/jpeg" })) as Blob,
|
(await heic2any({ blob: content, toType: "image/jpeg" })) as Blob,
|
||||||
);
|
);
|
||||||
} else {
|
} else if (contentType) {
|
||||||
contentUrl = URL.createObjectURL(content);
|
contentUrl = URL.createObjectURL(content);
|
||||||
}
|
} else {
|
||||||
|
FileSaver.saveAs(content, $info.name);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -80,18 +78,16 @@
|
|||||||
</div>
|
</div>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
|
|
||||||
{#if contentType === "image"}
|
{#if $info && contentType === "image"}
|
||||||
{#if $info && content}
|
{#if contentUrl}
|
||||||
{@const src = URL.createObjectURL(new Blob([content], { type: $info.contentType }))}
|
<img src={contentUrl} alt={$info.name} />
|
||||||
<img {src} alt={$info.name} />
|
|
||||||
{:else}
|
{:else}
|
||||||
{@render viewerLoading("이미지를 불러오고 있어요.")}
|
{@render viewerLoading("이미지를 불러오고 있어요.")}
|
||||||
{/if}
|
{/if}
|
||||||
{:else if contentType === "video"}
|
{:else if contentType === "video"}
|
||||||
{#if $info && content}
|
{#if contentUrl}
|
||||||
{@const src = URL.createObjectURL(new Blob([content], { type: $info.contentType }))}
|
|
||||||
<!-- svelte-ignore a11y_media_has_caption -->
|
<!-- svelte-ignore a11y_media_has_caption -->
|
||||||
<video {src} controls></video>
|
<video src={contentUrl} controls></video>
|
||||||
{:else}
|
{:else}
|
||||||
{@render viewerLoading("비디오를 불러오고 있어요.")}
|
{@render viewerLoading("비디오를 불러오고 있어요.")}
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
Reference in New Issue
Block a user