From f7bf9b3c89ef001b9db1d8c0e5ebe08223d721d9 Mon Sep 17 00:00:00 2001 From: Chad Parry Date: Sat, 23 Apr 2011 23:12:35 -0600 Subject: [PATCH] Extend the Keep Original module so that it is triggered by updated data files. --- 3.0/modules/keeporiginal/helpers/keeporiginal_event.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/3.0/modules/keeporiginal/helpers/keeporiginal_event.php b/3.0/modules/keeporiginal/helpers/keeporiginal_event.php index a5c29d3f..b026aee1 100644 --- a/3.0/modules/keeporiginal/helpers/keeporiginal_event.php +++ b/3.0/modules/keeporiginal/helpers/keeporiginal_event.php @@ -20,7 +20,10 @@ class keeporiginal_event_Core { static function graphics_rotate($input_file, $output_file, $options) { // Make a copy of the original fullsized image before rotating it. + self::preserve($input_file); + } + static function preserve($input_file) { // If $input_file is located in VARPATH/albums/ then assume its a fullsize photo. if (strncmp($input_file, VARPATH . "albums/", strlen(VARPATH . "albums/")) == 0) { // Figure out where the original copy should be stashed at. @@ -71,6 +74,9 @@ class keeporiginal_event_Core { // VARPATH/original/ as well. if ($old->is_photo() || $old->is_album()) { + if (isset($new->data_file)) { + self::preserve($old->file_path()); + } if ($old->file_path() != $new->file_path()) { $old_original = VARPATH . "original/" . str_replace(VARPATH . "albums/", "", $old->file_path()); $new_original = VARPATH . "original/" . str_replace(VARPATH . "albums/", "", $new->file_path());