diff options
author | Bharat Mediratta <bharat@menalto.com> | 2008-12-26 05:43:06 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2008-12-26 05:43:06 +0000 |
commit | dee20ed6a2bd92a2e67c27ccc7d60303d66cdcde (patch) | |
tree | 0d3b432effb5ba4cc8e6eb2c8627c9661d52ebe8 /modules/watermark/controllers | |
parent | 0bef37eb0b077863984eb70ec99c40b2f32840bf (diff) |
Added the concept of "permanent" messages that we show to admins. Use
this to show a "your thumbs/resizes are out of date" message whenever
we change the graphics rules. Tweak watermark module to add graphics
rules whenever we make a change, which triggers the graphics module to
add the permanent message.
Diffstat (limited to 'modules/watermark/controllers')
-rw-r--r-- | modules/watermark/controllers/admin_watermarks.php | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/modules/watermark/controllers/admin_watermarks.php b/modules/watermark/controllers/admin_watermarks.php index 733e0589..9f87fed4 100644 --- a/modules/watermark/controllers/admin_watermarks.php +++ b/modules/watermark/controllers/admin_watermarks.php @@ -40,8 +40,9 @@ class Admin_Watermarks_Controller extends Admin_Controller { public function edit() { $form = watermark::get_edit_form(); if ($form->validate()) { - module::set_var("watermark", "position", $form->edit_watermark->position->value); - graphics::mark_all_dirty(); + $position = $form->edit_watermark->position->value; + module::set_var("watermark", "position", $position); + $this->_update_graphics_rules(module::get_var("watermark", "name"), $position); log::success("watermark", _("Watermark changed")); message::success(_("Watermark changed")); @@ -70,7 +71,7 @@ class Admin_Watermarks_Controller extends Admin_Controller { module::clear_var("watermark", "height"); module::clear_var("watermark", "mime_type"); module::clear_var("watermark", "position"); - graphics::mark_all_dirty(); + $this->_update_graphics_rules(); log::success("watermark", _("Watermark deleted")); message::success(_("Watermark deleted")); @@ -105,12 +106,13 @@ class Admin_Watermarks_Controller extends Admin_Controller { } rename($file, VARPATH . "modules/watermark/$name"); + $position = $form->add_watermark->position->value; module::set_var("watermark", "name", $name); module::set_var("watermark", "width", $image_info[0]); module::set_var("watermark", "height", $image_info[1]); module::set_var("watermark", "mime_type", $image_info["mime"]); - module::set_var("watermark", "position", $form->add_watermark->position->value); - graphics::mark_all_dirty(); + module::set_var("watermark", "position", $position); + $this->_update_graphics_rules(module::get_var("watermark", "name"), $position); @unlink($file); message::success(_("Watermark saved")); @@ -124,4 +126,15 @@ class Admin_Watermarks_Controller extends Admin_Controller { "form" => $form->__toString())); } } + + private function _update_graphics_rules($name=null, $position=null) { + graphics::remove_rules("watermark"); + if ($name) { + graphics::add_rule( + "watermark", "thumb", "compose", + array("overlay" => VARPATH . "modules/watermark/$name", + "position" => $position), + 1000); + } + } }
\ No newline at end of file |