From baff63b70b2b686b14f468a26180081ad505ce9a Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 22 Feb 2009 05:21:44 +0000 Subject: Very basic movie support. You can upload a FLV file, we use ffmpeg to extract a thumbnail out of it and if you click through we show it using flowplayer. --- core/helpers/graphics.php | 47 ++++++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 19 deletions(-) (limited to 'core/helpers/graphics.php') diff --git a/core/helpers/graphics.php b/core/helpers/graphics.php index 4ec21ee8..2ea92873 100644 --- a/core/helpers/graphics.php +++ b/core/helpers/graphics.php @@ -115,7 +115,7 @@ class graphics_Core { ->where("target", $target) ->orderby("priority", "asc") ->find_all() as $rule) { - $args = array($working_file, $output_file, unserialize($rule->args)); + $args = array($item, $working_file, $output_file, unserialize($rule->args)); call_user_func_array(array("graphics", $rule->operation), $args); $working_file = $output_file; } @@ -141,35 +141,43 @@ class graphics_Core { * Resize an image. Valid options are width, height and master. Master is one of the Image * master dimension constants. * - * @param string $input_file - * @param string $output_file - * @param array $options + * @param Item_Model $item + * @param string $input_file + * @param string $output_file + * @param array $options */ - static function resize($input_file, $output_file, $options) { + static function resize($item, $input_file, $output_file, $options) { if (!self::$init) { self::init_toolkit(); } - Image::factory($input_file) - ->resize($options["width"], $options["height"], $options["master"]) - ->save($output_file); + if ($item->is_movie()) { + movie::extract_frame($input_file, $output_file); + } else if ($item->is_photo()) { + Image::factory($input_file) + ->resize($options["width"], $options["height"], $options["master"]) + ->save($output_file); + } } /** * Rotate an image. Valid options are degrees * - * @param string $input_file - * @param string $output_file - * @param array $options + * @param Item_Model $item + * @param string $input_file + * @param string $output_file + * @param array $options */ - static function rotate($input_file, $output_file, $options) { + static function rotate($item, $input_file, $output_file, $options) { if (!self::$init) { self::init_toolkit(); } - Image::factory($input_file) - ->rotate($options["degrees"]) - ->save($output_file); + if ($item->is_photo()) { + Image::factory($input_file) + ->rotate($options["degrees"]) + ->save($output_file); + } } /** @@ -177,11 +185,12 @@ class graphics_Core { * transparency_percent. * position is one of northwest, north, northeast, west, center, east, southwest, south, southeast * - * @param string $input_file - * @param string $output_file - * @param array $options + * @param Item_Model $item + * @param string $input_file + * @param string $output_file + * @param array $options */ - static function composite($input_file, $output_file, $options) { + static function composite($item, $input_file, $output_file, $options) { if (!self::$init) { self::init_toolkit(); } -- cgit v1.2.3