From 30d9551dabfdf4c7eafc780cc37778cff302cf2d Mon Sep 17 00:00:00 2001 From: rWatcher Date: Thu, 21 Apr 2011 19:08:57 -0400 Subject: [PATCH] Synced movie.php with changes in Gallery, modified uploadify html to accept videos. --- 3.0/modules/noffmpeg/helpers/movie.php | 21 +-- .../noffmpeg/views/form_uploadify.html.php | 164 ++++++++++++++++++ 3.1/modules/noffmpeg/helpers/movie.php | 21 +-- .../noffmpeg/views/form_uploadify.html.php | 164 ++++++++++++++++++ 4 files changed, 346 insertions(+), 24 deletions(-) create mode 100644 3.0/modules/noffmpeg/views/form_uploadify.html.php create mode 100644 3.1/modules/noffmpeg/views/form_uploadify.html.php diff --git a/3.0/modules/noffmpeg/helpers/movie.php b/3.0/modules/noffmpeg/helpers/movie.php index a42804d2..99308994 100644 --- a/3.0/modules/noffmpeg/helpers/movie.php +++ b/3.0/modules/noffmpeg/helpers/movie.php @@ -24,6 +24,7 @@ * Note: by design, this class does not do any permission checking. */ +// rWatcher edit: include MP4Info.php library. include MODPATH . "noffmpeg/libraries/MP4Info.php"; class movie_Core { @@ -61,7 +62,7 @@ class movie_Core { } static function extract_frame($input_file, $output_file) { - $ffmpeg = self::find_ffmpeg(); + $ffmpeg = movie::find_ffmpeg(); if (empty($ffmpeg)) { // BEGIN rWatcher Edit. copy(MODPATH . "noffmpeg/images/missing_movie.png", $output_file); @@ -89,27 +90,23 @@ class movie_Core { } } + /** + * Return the path to the ffmpeg binary if one exists and is executable, or null. + */ static function find_ffmpeg() { if (!($ffmpeg_path = module::get_var("gallery", "ffmpeg_path")) || !file_exists($ffmpeg_path)) { - $graphics_path = module::get_var("gallery", "graphics_toolkit_path", null); - - putenv("PATH=" . getenv("PATH") . (empty($graphics_path) ? "" : ":$graphics_path") . - ":/usr/local/bin:/opt/local/bin:/opt/bin"); - if (function_exists("exec")) { - $ffmpeg_path = exec("which ffmpeg"); - } - + $ffmpeg_path = system::find_binary( + "ffmpeg", module::get_var("gallery", "graphics_toolkit_path")); module::set_var("gallery", "ffmpeg_path", $ffmpeg_path); } return $ffmpeg_path; } - /** * Return the width, height, mime_type and extension of the given movie file. */ static function get_file_metadata($file_path) { - $ffmpeg = self::find_ffmpeg(); + $ffmpeg = movie::find_ffmpeg(); if (empty($ffmpeg)) { // BEGIN rWatcher Edit. $pi = pathinfo($file_path); @@ -147,4 +144,4 @@ class movie_Core { return array($width, $height, $mime_type, $extension); } -} +} \ No newline at end of file diff --git a/3.0/modules/noffmpeg/views/form_uploadify.html.php b/3.0/modules/noffmpeg/views/form_uploadify.html.php new file mode 100644 index 00000000..911e02d5 --- /dev/null +++ b/3.0/modules/noffmpeg/views/form_uploadify.html.php @@ -0,0 +1,164 @@ + + + + + +
+ admin && !$movies_allowed)): ?> +
+ +

+ suhosin.session.encrypt setting from Suhosin. You must disable this setting to upload photos.", + array("encrypt_url" => "http://www.hardened-php.net/suhosin/configuration.html#suhosin.session.encrypt", + "suhosin_url" => "http://www.hardened-php.net/suhosin/")) ?> +

+ + + admin && !$movies_allowed): ?> +

+ ffmpeg on your system. Movie uploading disabled. Help!", array("help_url" => "http://codex.gallery2.org/Gallery3:FAQ#Why_does_it_say_I.27m_missing_ffmpeg.3F")) ?> +

+ +
+ + +
+

+ +

+
    + parents() as $i => $parent): ?> + > title) ?> + +
  • title) ?>
  • +
+
+ +
+ + +
+
+
    +
+
+
+ + \ No newline at end of file diff --git a/3.1/modules/noffmpeg/helpers/movie.php b/3.1/modules/noffmpeg/helpers/movie.php index a42804d2..99308994 100644 --- a/3.1/modules/noffmpeg/helpers/movie.php +++ b/3.1/modules/noffmpeg/helpers/movie.php @@ -24,6 +24,7 @@ * Note: by design, this class does not do any permission checking. */ +// rWatcher edit: include MP4Info.php library. include MODPATH . "noffmpeg/libraries/MP4Info.php"; class movie_Core { @@ -61,7 +62,7 @@ class movie_Core { } static function extract_frame($input_file, $output_file) { - $ffmpeg = self::find_ffmpeg(); + $ffmpeg = movie::find_ffmpeg(); if (empty($ffmpeg)) { // BEGIN rWatcher Edit. copy(MODPATH . "noffmpeg/images/missing_movie.png", $output_file); @@ -89,27 +90,23 @@ class movie_Core { } } + /** + * Return the path to the ffmpeg binary if one exists and is executable, or null. + */ static function find_ffmpeg() { if (!($ffmpeg_path = module::get_var("gallery", "ffmpeg_path")) || !file_exists($ffmpeg_path)) { - $graphics_path = module::get_var("gallery", "graphics_toolkit_path", null); - - putenv("PATH=" . getenv("PATH") . (empty($graphics_path) ? "" : ":$graphics_path") . - ":/usr/local/bin:/opt/local/bin:/opt/bin"); - if (function_exists("exec")) { - $ffmpeg_path = exec("which ffmpeg"); - } - + $ffmpeg_path = system::find_binary( + "ffmpeg", module::get_var("gallery", "graphics_toolkit_path")); module::set_var("gallery", "ffmpeg_path", $ffmpeg_path); } return $ffmpeg_path; } - /** * Return the width, height, mime_type and extension of the given movie file. */ static function get_file_metadata($file_path) { - $ffmpeg = self::find_ffmpeg(); + $ffmpeg = movie::find_ffmpeg(); if (empty($ffmpeg)) { // BEGIN rWatcher Edit. $pi = pathinfo($file_path); @@ -147,4 +144,4 @@ class movie_Core { return array($width, $height, $mime_type, $extension); } -} +} \ No newline at end of file diff --git a/3.1/modules/noffmpeg/views/form_uploadify.html.php b/3.1/modules/noffmpeg/views/form_uploadify.html.php new file mode 100644 index 00000000..911e02d5 --- /dev/null +++ b/3.1/modules/noffmpeg/views/form_uploadify.html.php @@ -0,0 +1,164 @@ + + + + + +
+ admin && !$movies_allowed)): ?> +
+ +

+ suhosin.session.encrypt setting from Suhosin. You must disable this setting to upload photos.", + array("encrypt_url" => "http://www.hardened-php.net/suhosin/configuration.html#suhosin.session.encrypt", + "suhosin_url" => "http://www.hardened-php.net/suhosin/")) ?> +

+ + + admin && !$movies_allowed): ?> +

+ ffmpeg on your system. Movie uploading disabled. Help!", array("help_url" => "http://codex.gallery2.org/Gallery3:FAQ#Why_does_it_say_I.27m_missing_ffmpeg.3F")) ?> +

+ +
+ + +
+

+ +

+
    + parents() as $i => $parent): ?> + > title) ?> + +
  • title) ?>
  • +
+
+ +
+ + +
+
+
    +
+
+
+ + \ No newline at end of file