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

Commit

Permalink
collage: remove all images from gallery on discard/delete from result…
Browse files Browse the repository at this point in the history
… screen

Change-Id: Id24c284e6dc0f0ce3c95eecb10ea9df91aa8ff6c
  • Loading branch information
andi34 committed Sep 27, 2021
1 parent e032bab commit 276e477
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
1 change: 1 addition & 0 deletions api/applyEffects.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,4 +269,5 @@

echo json_encode([
'file' => $file,
'images' => $srcImages,
]);
33 changes: 19 additions & 14 deletions src/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,7 @@ const photoBooth = (function () {
endTime = new Date().getTime();
totalTime = endTime - startTime;
photoboothTools.console.logDev('Processing ' + photoStyle + ' took ' + totalTime + 'ms');
photoboothTools.console.logDev('Images:', data.images);

if (config.get_request.processed) {
const getUrl = config.get_request.server + '/' + photoStyle;
Expand All @@ -644,7 +645,7 @@ const photoBooth = (function () {
} else if (photoStyle === 'chroma') {
api.renderChroma(data.file);
} else {
api.renderPic(data.file);
api.renderPic(data.file, data.images);
}
},
error: (jqXHR, textStatus) => {
Expand Down Expand Up @@ -688,7 +689,7 @@ const photoBooth = (function () {
};

// Render Picture after taking
api.renderPic = function (filename) {
api.renderPic = function (filename, files) {
// Add QR Code Image
const qrCodeModal = $('#qrCode');
photoboothTools.modal.empty(qrCodeModal);
Expand Down Expand Up @@ -739,23 +740,27 @@ const photoBooth = (function () {
const msg = photoboothTools.getTranslation('really_delete_image');
const really = config.delete.no_request ? true : confirm(filename + ' ' + msg);
if (really) {
api.deleteImage(filename, (data) => {
if (data.success) {
photoboothTools.console.log('Deleted ' + filename);
photoboothTools.reloadPage();
} else {
photoboothTools.console.log('Error while deleting ' + filename);
if (data.error) {
photoboothTools.console.log(data.error);
files.forEach(function (file, index, array) {
photoboothTools.console.logDev('Index:', index);
photoboothTools.console.logDev('Array:', array);
api.deleteImage(file, (data) => {
if (data.success) {
photoboothTools.console.log('Deleted ' + file);
} else {
photoboothTools.console.log('Error while deleting ' + file);
if (data.error) {
photoboothTools.console.log(data.error);
}
setTimeout(function () {
photoboothTools.reloadPage();
}, 5000);
}
setTimeout(function () {
photoboothTools.reloadPage();
}, 5000);
}
});
});
} else {
$('.deletebtn').blur();
}
photoboothTools.reloadPage();
});

// Add Image to gallery and slider
Expand Down

0 comments on commit 276e477

Please sign in to comment.