mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-22 07:46:17 -04:00
Fix thumbnail creation on iOS devices
This commit is contained in:
parent
a5cc115fa6
commit
73759be0a9
2 changed files with 4 additions and 17 deletions
|
@ -278,22 +278,10 @@ class PeersUI {
|
||||||
|
|
||||||
if (files[0].type.split('/')[0] === 'image') {
|
if (files[0].type.split('/')[0] === 'image') {
|
||||||
try {
|
try {
|
||||||
let image = files[0]
|
let imageUrl = await getThumbnailAsDataUrl(files[0], 80, null, 0.9);
|
||||||
|
|
||||||
// Heic files can't be shown by browsers natively --> convert to jpeg
|
|
||||||
if (image.type === "image/heif" || image.type === "image/heic") {
|
|
||||||
let blob = await fileToBlob(image);
|
|
||||||
image = await heic2any({
|
|
||||||
blob,
|
|
||||||
toType: "image/jpeg",
|
|
||||||
quality: 0.9
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
let imageUrl = URL.createObjectURL(image);
|
|
||||||
this.$shareModeImageThumb.style.backgroundImage = `url(${imageUrl})`;
|
this.$shareModeImageThumb.style.backgroundImage = `url(${imageUrl})`;
|
||||||
|
|
||||||
await waitUntilImageIsLoaded(imageUrl);
|
|
||||||
this.$shareModeImageThumb.removeAttribute('hidden');
|
this.$shareModeImageThumb.removeAttribute('hidden');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
|
|
|
@ -661,19 +661,18 @@ x-dialog .dialog-subheader {
|
||||||
margin-right: 6px;
|
margin-right: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.shr-panel .text-thumb svg {
|
.shr-panel .thumb > .text-thumb > svg {
|
||||||
width: 18px;
|
width: 18px;
|
||||||
height: 36px;
|
height: 36px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.shr-panel .file-thumb svg {
|
.shr-panel .thumb > .file-thumb > svg {
|
||||||
width: 36px;
|
width: 36px;
|
||||||
height: 36px;
|
height: 36px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.shr-panel .thumb .image-thumb {
|
.shr-panel .thumb > .image-thumb {
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
border-radius: 6px;
|
|
||||||
background-position: center;
|
background-position: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue