Skip to content
This repository was archived by the owner on Aug 27, 2022. It is now read-only.

Commit 276e477

Browse files
committed
collage: remove all images from gallery on discard/delete from result screen
Change-Id: Id24c284e6dc0f0ce3c95eecb10ea9df91aa8ff6c
1 parent e032bab commit 276e477

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

api/applyEffects.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,4 +269,5 @@
269269

270270
echo json_encode([
271271
'file' => $file,
272+
'images' => $srcImages,
272273
]);

src/js/core.js

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,7 @@ const photoBooth = (function () {
630630
endTime = new Date().getTime();
631631
totalTime = endTime - startTime;
632632
photoboothTools.console.logDev('Processing ' + photoStyle + ' took ' + totalTime + 'ms');
633+
photoboothTools.console.logDev('Images:', data.images);
633634

634635
if (config.get_request.processed) {
635636
const getUrl = config.get_request.server + '/' + photoStyle;
@@ -644,7 +645,7 @@ const photoBooth = (function () {
644645
} else if (photoStyle === 'chroma') {
645646
api.renderChroma(data.file);
646647
} else {
647-
api.renderPic(data.file);
648+
api.renderPic(data.file, data.images);
648649
}
649650
},
650651
error: (jqXHR, textStatus) => {
@@ -688,7 +689,7 @@ const photoBooth = (function () {
688689
};
689690

690691
// Render Picture after taking
691-
api.renderPic = function (filename) {
692+
api.renderPic = function (filename, files) {
692693
// Add QR Code Image
693694
const qrCodeModal = $('#qrCode');
694695
photoboothTools.modal.empty(qrCodeModal);
@@ -739,23 +740,27 @@ const photoBooth = (function () {
739740
const msg = photoboothTools.getTranslation('really_delete_image');
740741
const really = config.delete.no_request ? true : confirm(filename + ' ' + msg);
741742
if (really) {
742-
api.deleteImage(filename, (data) => {
743-
if (data.success) {
744-
photoboothTools.console.log('Deleted ' + filename);
745-
photoboothTools.reloadPage();
746-
} else {
747-
photoboothTools.console.log('Error while deleting ' + filename);
748-
if (data.error) {
749-
photoboothTools.console.log(data.error);
743+
files.forEach(function (file, index, array) {
744+
photoboothTools.console.logDev('Index:', index);
745+
photoboothTools.console.logDev('Array:', array);
746+
api.deleteImage(file, (data) => {
747+
if (data.success) {
748+
photoboothTools.console.log('Deleted ' + file);
749+
} else {
750+
photoboothTools.console.log('Error while deleting ' + file);
751+
if (data.error) {
752+
photoboothTools.console.log(data.error);
753+
}
754+
setTimeout(function () {
755+
photoboothTools.reloadPage();
756+
}, 5000);
750757
}
751-
setTimeout(function () {
752-
photoboothTools.reloadPage();
753-
}, 5000);
754-
}
758+
});
755759
});
756760
} else {
757761
$('.deletebtn').blur();
758762
}
763+
photoboothTools.reloadPage();
759764
});
760765

761766
// Add Image to gallery and slider

0 commit comments

Comments
 (0)