Skip to content

Commit b2b5a1e

Browse files
imageViewer updated.
1 parent a01ef7e commit b2b5a1e

File tree

5 files changed

+8
-13
lines changed

5 files changed

+8
-13
lines changed

src/app/molecules/media/Media.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ function Image({
194194
imageLoaded = true;
195195
const img = $(event.target);
196196
const imgAction = () => {
197-
imageViewer({ lightbox, imgQuery: img, name, url });
197+
imageViewer({ lightbox, imgQuery: img, name });
198198
};
199199

200200
img.off('click', imgAction);

src/app/organisms/profile-viewer/ProfileViewer.jsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -461,9 +461,7 @@ function ProfileViewer() {
461461
onClose: reopenProfile,
462462
imgQuery: img,
463463
name: username,
464-
url: img.attr('src'),
465464
originalUrl: newAvatar,
466-
readMime: true,
467465
});
468466
}
469467
};
@@ -682,9 +680,7 @@ function ProfileViewer() {
682680
lightbox,
683681
imgQuery: img,
684682
name: userId,
685-
url: img.attr('src'),
686683
originalUrl: newAvatar,
687-
readMime: true,
688684
});
689685
}
690686
};

src/app/organisms/profile-viewer/RoomViewer.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,7 @@ function RoomViewer() {
247247
lightbox,
248248
imgQuery: img,
249249
name: username,
250-
url: img.attr('src'),
251250
originalUrl: newAvatar,
252-
readMime: true,
253251
});
254252
}
255253
};

src/util/imageViewer.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ export default function imageViewer(data) {
1414
// Read Image Tag
1515
const img = data.imgQuery.get(0);
1616
if (img) {
17+
// File Url
18+
const url = data.imgQuery.attr('src');
19+
1720
// Get Mime
1821
let filename = data.name;
1922

@@ -41,7 +44,7 @@ export default function imageViewer(data) {
4144
const options = {
4245
dataSource: [
4346
{
44-
src: data.url,
47+
src: url,
4548
alt: filename,
4649
width: imgData.width,
4750
height: imgData.height,
@@ -67,7 +70,7 @@ export default function imageViewer(data) {
6770
isButton: true,
6871
html: '<i class="fa-solid fa-arrow-up-right-from-square pswp__icn" height="32" width="32"></i>',
6972
onClick: () => {
70-
window.open(data.url, '_blank').focus();
73+
window.open(url, '_blank').focus();
7174
},
7275
});
7376
}
@@ -79,7 +82,7 @@ export default function imageViewer(data) {
7982
isButton: true,
8083
html: '<i class="fa-solid fa-floppy-disk pswp__icn" height="32" width="32"></i>',
8184
onClick: () => {
82-
FileSaver.saveAs(data.url, filename);
85+
FileSaver.saveAs(url, filename);
8386
},
8487
});
8588

@@ -90,7 +93,7 @@ export default function imageViewer(data) {
9093
isButton: true,
9194
html: '<i class="fa-solid fa-circle-info pswp__icn" height="32" width="32"></i>',
9295
onClick: () => {
93-
fetchFn(data.url)
96+
fetchFn(url)
9497
.then((res) => res.arrayBuffer())
9598
.then(async (body) => {
9699
const newTags = await ExifReader.load(body, {

src/util/libs/image.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ export function openOnGallery(imgUrl, fileName /* urlRevoke = false */) {
88
lightbox: null,
99
imgQuery: $(img),
1010
name: fileName,
11-
url: imgUrl,
12-
readMime: false,
1311
}).then((/* pswp */) => {
1412
/* pswp.on('close', () => {
1513
pswp.destroy();

0 commit comments

Comments
 (0)