diff options
| author | Bharat Mediratta <bharat@menalto.com> | 2009-02-22 05:21:44 +0000 |
|---|---|---|
| committer | Bharat Mediratta <bharat@menalto.com> | 2009-02-22 05:21:44 +0000 |
| commit | baff63b70b2b686b14f468a26180081ad505ce9a (patch) | |
| tree | 6e2013bfa64dcaae1be5a9c4fa3d4bc1a508fefb /core/helpers/graphics.php | |
| parent | e6836d8a5ed06cb25c3f0d61b1c24a48e49e93f3 (diff) | |
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.
Diffstat (limited to 'core/helpers/graphics.php')
| -rw-r--r-- | core/helpers/graphics.php | 47 |
1 files changed, 28 insertions, 19 deletions
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(); } |
