Skip to content

Commit

Permalink
Add new events:
Browse files Browse the repository at this point in the history
  graphics_resize
  graphics_resize_completed
  graphics_rotate
  graphics_rotate_completed
  graphics_composite
  graphics_composite_completed
  • Loading branch information
bharat committed Jul 31, 2009
1 parent 86c7fab commit f034c6c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions modules/gallery/helpers/graphics.php
Expand Up @@ -195,6 +195,8 @@ static function resize($input_file, $output_file, $options) {
self::init_toolkit();
}

module::event("graphics_resize", $input_file, $output_file, $options);

if (@filesize($input_file) == 0) {
throw new Exception("@todo EMPTY_INPUT_FILE");
}
Expand All @@ -209,6 +211,8 @@ static function resize($input_file, $output_file, $options) {
->quality(module::get_var("gallery", "image_quality"))
->save($output_file);
}

module::event("graphics_resize_completed", $input_file, $output_file, $options);
}

/**
Expand All @@ -223,10 +227,14 @@ static function rotate($input_file, $output_file, $options) {
self::init_toolkit();
}

module::event("graphics_rotate", $input_file, $output_file, $options);

Image::factory($input_file)
->quality(module::get_var("gallery", "image_quality"))
->rotate($options["degrees"])
->save($output_file);

module::event("graphics_rotate_completed", $input_file, $output_file, $options);
}

/**
Expand All @@ -249,6 +257,8 @@ static function composite($input_file, $output_file, $options) {
self::init_toolkit();
}

module::event("graphics_composite", $input_file, $output_file, $options);

list ($width, $height) = getimagesize($input_file);
list ($w_width, $w_height) = getimagesize($options["file"]);

Expand Down Expand Up @@ -276,6 +286,9 @@ static function composite($input_file, $output_file, $options) {
->composite($options["file"], $x, $y, $options["transparency"])
->quality(module::get_var("gallery", "image_quality"))
->save($output_file);


module::event("graphics_composite_completed", $input_file, $output_file, $options);
}

/**
Expand Down

0 comments on commit f034c6c

Please sign in to comment.