summaryrefslogtreecommitdiff
path: root/modules/watermark/controllers
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2008-12-29 20:17:24 +0000
committerBharat Mediratta <bharat@menalto.com>2008-12-29 20:17:24 +0000
commit8102d8ea7727b259d665ef849c26c0a29019676f (patch)
treee214aab2d7ccc659875ba03b85a8325a68a6a8b3 /modules/watermark/controllers
parent95f1440ef22dcfec43f19909292b2c357ceab5aa (diff)
Clean up _update_graphics_rules() to make it more robust
Diffstat (limited to 'modules/watermark/controllers')
-rw-r--r--modules/watermark/controllers/admin_watermarks.php17
1 files changed, 10 insertions, 7 deletions
diff --git a/modules/watermark/controllers/admin_watermarks.php b/modules/watermark/controllers/admin_watermarks.php
index 1abd0d10..af4d57f5 100644
--- a/modules/watermark/controllers/admin_watermarks.php
+++ b/modules/watermark/controllers/admin_watermarks.php
@@ -43,7 +43,7 @@ class Admin_Watermarks_Controller extends Admin_Controller {
if ($form->validate()) {
$position = $form->edit_watermark->position->value;
module::set_var("watermark", "position", $position);
- $this->_update_graphics_rules(module::get_var("watermark", "name"), $position);
+ $this->_update_graphics_rules();
log::success("watermark", _("Watermark changed"));
message::success(_("Watermark changed"));
@@ -115,7 +115,7 @@ class Admin_Watermarks_Controller extends Admin_Controller {
module::set_var("watermark", "height", $image_info[1]);
module::set_var("watermark", "mime_type", $image_info["mime"]);
module::set_var("watermark", "position", $position);
- $this->_update_graphics_rules(module::get_var("watermark", "name"), $position);
+ $this->_update_graphics_rules();
@unlink($file);
message::success(_("Watermark saved"));
@@ -130,14 +130,17 @@ class Admin_Watermarks_Controller extends Admin_Controller {
}
}
- private function _update_graphics_rules($name=null, $position=null) {
+ private function _update_graphics_rules() {
graphics::remove_rules("watermark");
- if ($name) {
+ if ($name = module::get_var("watermark", "name")) {
foreach (array("thumb", "resize") as $target) {
graphics::add_rule(
- "watermark", $target, "compose",
- array("overlay" => VARPATH . "modules/watermark/$name",
- "position" => $position),
+ "watermark", $target, "composite",
+ array("file" => VARPATH . "modules/watermark/$name",
+ "width" => module::get_var("watermark", "width"),
+ "height" => module::get_var("watermark", "height"),
+ "mime_type" => module::get_var("watermark", "mime_type"),
+ "position" => module::get_var("watermark", "position")),
1000);
}
}