コード例 #1
0
 /**
  * Get PDF file metadata (height and width)
  * (ref: movie::get_file_metadata())
  */
 static function movie_get_file_metadata($file_path, $metadata)
 {
     if (strtolower(pathinfo($file_path, PATHINFO_EXTENSION)) == "pdf" && ($path = pdf::find_gs())) {
         // Parsing gs output properly can be a pain.  So, let's go for a reliable albeit inefficient
         // approach: re-extract the frame (into tmp) and get its image size.
         $temp_file = system::temp_filename("pdf_", "jpg");
         pdf_event::movie_extract_frame($file_path, $temp_file, null, null);
         list($metadata->height, $metadata->width) = photo::get_file_metadata($temp_file);
     }
 }
コード例 #2
0
ファイル: pdf.php プロジェクト: webmatter/gallery3-contrib
 /**
  * Return version number of gs if found, an empty string if not.
  * (ref: movie::get_ffmpeg_version())
  */
 static function get_gs_version()
 {
     if (pdf::find_gs()) {
         $path = module::get_var("pdf", "gs_path");
         exec(escapeshellcmd($path) . " -version", $output);
         if (stristr($output[0], "ghostscript")) {
             // Found "ghostscript" in the response - it's valid.
             return $output[0];
         }
     }
     return "";
 }
コード例 #3
0
 static function install()
 {
     // Set gs_path variable
     if ($gs_path = exec("which gs")) {
         module::set_var("pdf", "gs_path", $gs_path);
     }
     pdf::find_gs();
     // Set other variables
     module::set_var("pdf", "make_thumb", true);
     module::set_var("pdf", "movie_overlay_hide", false);
     module::set_version("pdf", 1);
 }
コード例 #4
0
 private function _print_screen($form)
 {
     // get module parameters
     $gs_path = pdf::find_gs();
     $gs_dir = substr($gs_path, 0, strrpos($gs_path, "/"));
     $gs_version = pdf::get_gs_version();
     // make and print view
     $view = new Admin_View("admin.html");
     $view->page_title = t("PDF settings");
     $view->content = new View("admin_pdf.html");
     $view->content->form = $form;
     $view->content->gs_dir = $gs_dir;
     $view->content->gs_version = $gs_version;
     print $view;
 }