diff options
author | plegall <plg@piwigo.org> | 2012-04-30 09:44:51 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2012-04-30 09:44:51 +0000 |
commit | b219d87284b1bca9fe2a0257544cd26e37043dac (patch) | |
tree | 19df762d351145efd1db71b7aa2a68943ae3dc3f | |
parent | 1468b3adc5a33763687e073e96cb17c1b412a94b (diff) |
feature 2626: fix watermark form submission (with the help of rvelices)
git-svn-id: http://piwigo.org/svn/trunk@14580 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r-- | admin/include/configuration_watermark_process.inc.php | 60 |
1 files changed, 13 insertions, 47 deletions
diff --git a/admin/include/configuration_watermark_process.inc.php b/admin/include/configuration_watermark_process.inc.php index a253e9980..5440493a6 100644 --- a/admin/include/configuration_watermark_process.inc.php +++ b/admin/include/configuration_watermark_process.inc.php @@ -129,62 +129,28 @@ if (count($errors) == 0) || $watermark->xrepeat != $old_watermark->xrepeat || $watermark->opacity != $old_watermark->opacity; - // do we have to regenerate the derivatives? - $old_enabled = ImageStdParams::get_defined_type_map(); - // $disabled = @unserialize( @$conf['disabled_derivatives'] ); - // if ($disabled===false) - // { - // $disabled = array(); - // } - // save the new watermark configuration ImageStdParams::set_watermark($watermark); - $new_enabled = ImageStdParams::get_defined_type_map(); - + // do we have to regenerate the derivatives (and which types)? + $types = ImageStdParams::get_defined_type_map(); $changed_types = array(); - - foreach(ImageStdParams::get_all_types() as $type) + + foreach ($types as $type => $params) { - if (isset($old_enabled[$type])) - { - $old_params = $old_enabled[$type]; - // echo '<pre>old '.$type."\n"; print_r($old_params); echo '</pre>'; - - $new_params = $new_enabled[$type]; - ImageStdParams::apply_global($new_params); - // echo '<pre>new '.$type."\n"; print_r($old_params); echo '</pre>'; - - $same = true; - - if ($new_params->use_watermark != $old_params->use_watermark - or $new_params->use_watermark and $watermark_changed) - { - $same = false; - } - - if (!$same) - { - $new_params->last_mod_time = time(); - $changed_types[] = $type; - } - else - { - $new_params->last_mod_time = $old_params->last_mod_time; - } - $new_enabled[$type] = $new_params; - } - } + $old_use_watermark = $params->use_watermark; + ImageStdParams::apply_global($params); - $enabled_by = array(); // keys ordered by all types - foreach(ImageStdParams::get_all_types() as $type) - { - if (isset($new_enabled[$type])) + if ($params->use_watermark != $old_use_watermark + or $params->use_watermark and $watermark_changed) { - $enabled_by[$type] = $new_enabled[$type]; + $params->last_mod_time = time(); + $changed_types[] = $type; + $types[$type] = $params; } } - ImageStdParams::set_and_save($enabled_by); + + ImageStdParams::set_and_save($types); if (count($changed_types)) { |