diff options
author | Bharat Mediratta <bharat@menalto.com> | 2008-12-29 23:25:28 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2008-12-29 23:25:28 +0000 |
commit | 4ab53d145bec440529a6304f470eb952a40eec6b (patch) | |
tree | 77c534b43cff4398c065f5eb2bdf140c3520b5db /kohana/libraries/Image.php | |
parent | 4439ca94a9850261d7f27d06c8327eafe0ff1ea3 (diff) |
Create Image::composite() and implement it in GD, ImageMagick and GraphicsMagick drivers.
Diffstat (limited to 'kohana/libraries/Image.php')
-rw-r--r-- | kohana/libraries/Image.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/kohana/libraries/Image.php b/kohana/libraries/Image.php index bd723a27..6fcce090 100644 --- a/kohana/libraries/Image.php +++ b/kohana/libraries/Image.php @@ -255,6 +255,35 @@ class Image_Core { } /** + * Overlay a second image on top of this one. + * + * @throws Kohana_Exception + * @param string $overlay_file path to an image file + * @param integer $x x offset for the overlay + * @param integer $y y offset for the overlay + * @param integer $transparency transparency percent + */ + public function composite($overlay_file, $x, $y, $transparency) + { + $image_info = getimagesize($overlay_file); + + // Check to make sure the image type is allowed + if ( ! isset(Image::$allowed_types[$image_info[2]])) + throw new Kohana_Exception('image.type_not_allowed', $overlay_file); + + $this->actions['composite'] = array + ( + 'overlay_file' => $overlay_file, + 'mime' => $image_info['mime'], + 'x' => $x, + 'y' => $y, + 'transparency' => $transparency + ); + + return $this; + } + + /** * Flip an image horizontally or vertically. * * @throws Kohana_Exception |