From 57be3cd78b3f56eeb0375bd554d53885d19325f5 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 3 Jan 2009 05:25:52 +0000 Subject: Add graphics::rotate --- core/helpers/graphics.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'core/helpers') diff --git a/core/helpers/graphics.php b/core/helpers/graphics.php index 85f86863..53cf01db 100644 --- a/core/helpers/graphics.php +++ b/core/helpers/graphics.php @@ -137,6 +137,23 @@ class graphics_Core { ->save($output_file); } + /** + * Rotate an image. Valid options are degrees + * + * @param string $input_file + * @param string $output_file + * @param array $options + */ + public static function rotate($input_file, $output_file, $options) { + if (!self::$init) { + self::init_toolkit(); + } + + Image::factory($input_file) + ->rotate($options["degrees"]) + ->save($output_file); + } + /** * Overlay an image on top of the input file. Valid options are file, mime_type, position and * transparency_percent. @@ -258,8 +275,7 @@ class graphics_Core { * GraphicsMagick we return the path to the directory containing the appropriate binaries. */ public static function detect_toolkits() { - $gd_info = gd_info(); - return array("gd" => $gd_info["GD Version"], + return array("gd" => gd_info(), "imagemagick" => dirname(exec("which convert")), "graphicsmagick" => dirname(exec("which gm"))); } -- cgit v1.2.3