diff --git a/api/applyEffects.php b/api/applyEffects.php index f7cf9adc0..369a0230b 100644 --- a/api/applyEffects.php +++ b/api/applyEffects.php @@ -34,6 +34,12 @@ 'error' => 'Could not create collage' ])); } + + if (!$config['keep_images']) { + foreach ($collageSrcImagePaths as $tmp) { + unlink($tmp); + } + } } if (!file_exists($filename_tmp)) { @@ -43,6 +49,7 @@ } $imageResource = imagecreatefromjpeg($filename_tmp); +$imageModified = false; if (!$imageResource) { die(json_encode([ @@ -65,12 +72,13 @@ // apply filter if ($image_filter) { applyFilter($image_filter, $imageResource); + $imageModified = true; } if ($config['polaroid_effect']) { $polaroid_rotation = $config['polaroid_rotation']; - $imageResource = effectPolaroid($imageResource, $polaroid_rotation, 200, 200, 200); + $imageModified = true; } if ($config['take_frame'] && $_POST['isCollage'] !== 'true') { @@ -79,11 +87,11 @@ $x = (imagesx($imageResource)/2) - (imagesx($frame)/2); $y = (imagesy($imageResource)/2) - (imagesy($frame)/2); imagecopy($imageResource, $frame, $x, $y, 0, 0, imagesx($frame), imagesy($frame)); + $imageModified = true; } if ($config['chroma_keying']) { $chromaCopyResource = resizeImage($imageResource, 1500, 1000); - imagejpeg($chromaCopyResource, $filename_keying, $config['jpeg_quality_chroma']); imagedestroy($chromaCopyResource); } @@ -94,7 +102,16 @@ imagejpeg($thumbResource, $filename_thumb, $config['jpeg_quality_thumb']); imagedestroy($thumbResource); -imagejpeg($imageResource, $filename_photo, $config['jpeg_quality_image']); +if ($imageModified || $config['jpeg_quality_image'] >= 0) { + imagejpeg($imageResource, $filename_photo, $config['jpeg_quality_image']); +} else { + copy($filename_tmp, $filename_photo); +} + +if (!$config['keep_images']) { + unlink($filename_tmp); +} + imagedestroy($imageResource); // insert into database diff --git a/config/config.inc.php b/config/config.inc.php index e89d27b10..3935c96eb 100644 --- a/config/config.inc.php +++ b/config/config.inc.php @@ -28,6 +28,7 @@ $config['cntdwn_time'] = '5'; // control countdown timer $config['collage_cntdwn_time'] = '3'; // control countdown timer between collage pictures $config['cheese_time'] = '1000'; // control time for cheeeeese! +$config['keep_images'] = true; $config['use_filter'] = true; $config['default_imagefilter'] = 'plain'; $config['disabled_filters'] = array(); diff --git a/lib/configsetup.inc.php b/lib/configsetup.inc.php index cc06d13f6..055510601 100644 --- a/lib/configsetup.inc.php +++ b/lib/configsetup.inc.php @@ -33,6 +33,11 @@ 'name' => 'dev', 'value' => $config['dev'] ], + 'keep_images' => [ + 'type' => 'checkbox', + 'name' => 'keep_images', + 'value' => $config['keep_images'] + ], 'show_error_messages' => [ 'type' => 'checkbox', 'name' => 'show_error_messages', diff --git a/resources/lang/de.js b/resources/lang/de.js index c504c456c..ddb940ed2 100644 --- a/resources/lang/de.js +++ b/resources/lang/de.js @@ -90,6 +90,7 @@ const L10N = { 'folders_tmp': 'tmp Ordner', 'folders_keying': 'Keying Ordner', 'folders_data': 'Data Ordner', + 'keep_images': 'Original Bilder im tmp Ordner behalten', 'general_language': 'Sprache', 'send_all_later': 'Checkbox aktivieren um die eingegebene Adresse einer Datei hinzuzufügen (z.B. um später eine Mail mit allen Bildern zu versenden)', 'mail_host': 'E-Mail Host Adresse', diff --git a/resources/lang/en.js b/resources/lang/en.js index a582a559b..9afb1ee20 100644 --- a/resources/lang/en.js +++ b/resources/lang/en.js @@ -90,6 +90,7 @@ const L10N = { 'folders_tmp': 'tmp Folder', 'folders_keying': 'Keying Folder', 'folders_data': 'Data Folder', + 'keep_images': 'Keep original images in tmp folder', 'general_language': 'Language', 'send_all_later': 'Activate checkbox to add the entered address to a file (for example, to send a mail with all pictures later)', 'mail_host': 'E-mail host adress', diff --git a/resources/lang/es.js b/resources/lang/es.js index e435691d5..d763a9b2f 100644 --- a/resources/lang/es.js +++ b/resources/lang/es.js @@ -90,6 +90,7 @@ const L10N = { 'folders_tmp': 'Carpeta búfer', 'folders_keying': 'Carpeta de croma verde', 'folders_data': 'Carpeta de data', + 'keep_images': 'Keep original images in tmp folder', 'general_language': 'Idioma general', 'send_all_later': 'Active la casilla de verificación para añadir el correo electrónico ingresado a un fichero (por ejemplo, para enviar todas las fotos más tarde)', 'mail_host': 'Correo electrónico de anfitrión', diff --git a/resources/lang/fr.js b/resources/lang/fr.js index ed308bbf1..cee0922b3 100644 --- a/resources/lang/fr.js +++ b/resources/lang/fr.js @@ -91,6 +91,7 @@ const L10N = { 'folders_data': 'Dossier data', 'folders_keying': 'Dossier font vert', 'general_language': 'La langue', + 'keep_images': 'Keep original images in tmp folder', 'send_all_later': 'Activez la case à cocher pour ajouter l\'adresse saisie à un fichier (par exemple, pour envoyer un courrier avec toutes les images ultérieurement)', 'mail_host': 'Adresse mail de l\'hôte', 'mail_username': 'Nom d\'utilisateur du compte de messagerie', diff --git a/resources/lang/gr.js b/resources/lang/gr.js index 5a7858342..629753690 100644 --- a/resources/lang/gr.js +++ b/resources/lang/gr.js @@ -90,6 +90,7 @@ const L10N = { 'folders_tmp': 'tmp φάκελο', 'folders_keying': 'Keying αρχείο', 'general_language': 'γλώσσα', + 'keep_images': 'Keep original images in tmp folder', 'send_all_later': 'Ενεργοποιήστε το πλαίσιο ελέγχου για να προσθέσετε την καταχωρημένη διεύθυνση σε ένα αρχείο(π.χ. για να στείλετε ένα μήνυμα αργότερα με όλες τις εικόνες)', 'mail_host': 'E-Mail Διεύθυνση κεντρικού υπολογιστή', 'mail_username': 'Όνομα χρήστη του E-Mail',