From 2b9b6991b28cada6abf4af73f9286495358a3839 Mon Sep 17 00:00:00 2001 From: Nathan Kinkade Date: Tue, 14 Jan 2014 23:37:41 +0000 Subject: Added a module that displays a play button icon over movie thumbnails so people know they are actually movies and not just photos. --- .../movie_overlay/helpers/movie_overlay_theme.php | 93 ++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 modules/movie_overlay/helpers/movie_overlay_theme.php (limited to 'modules/movie_overlay/helpers/movie_overlay_theme.php') diff --git a/modules/movie_overlay/helpers/movie_overlay_theme.php b/modules/movie_overlay/helpers/movie_overlay_theme.php new file mode 100644 index 00000000..531cecd5 --- /dev/null +++ b/modules/movie_overlay/helpers/movie_overlay_theme.php @@ -0,0 +1,93 @@ +file_path()) . " 2>&1"; + $result = `$cmd`; + if (preg_match("/Duration: (\d+):(\d+):(\d+\.\d+)/", $result, $regs)) { + return 3600 * $regs[1] + 60 * $regs[2] + $regs[3]; + } else if (preg_match("/duration.*?:.*?(\d+)/", $result, $regs)) { + return $regs[1]; + } else { + return '00'; + } + } + static function head($theme, $child) { + if ($theme->page_type == "collection") { + $trans = module::get_var("movie_overlay", "trans"); + return "\t"; + } + } + static function thumb_top($theme, $child) { + if ($child->type == "movie") { + return ("
thumb_width}px;\">\n"); + } + } + static function thumb_bottom($theme, $child) { + if ($child->type == "movie") { + $view = new View("movie_thumb_bottom.html"); + // pass some variable to the view + $view->url = $child->url(); + $view->top = round($child->thumb_height / 2 - 20); + $view->texttime_top = round($child->thumb_height - 25); // position the movie duration from the top as some themes add stuff below the thumb + $view->left = round($child->thumb_width / 2 - 20); + $view->images_url = url::file("modules/movie_overlay/images"); + $view->icon = module::get_var("movie_overlay", "icon"); + $view->trans = module::get_var("movie_overlay", "trans"); + $view->movie_time = number_format(movie_overlay_theme_Core::get_movie_time($child), 2); + return $view; + } + } + +} -- cgit v1.2.3