Пример #1
0
 /**
  * Detect if FFmpeg is available on the system.
  *
  * @return void
  */
 function autoDetect()
 {
     static $output, $status;
     //get the absolute location first:
     $path = zmgVideoTool::detectPath();
     //execute test command
     @exec($path . 'ffmpeg', $output, $status);
     $res = false;
     if (!empty($output[0])) {
         if (preg_match("/(ffmpeg).*/i", $output[0], $matches)) {
             zmgToolboxPlugin::registerError('FFmpeg', 'FFmpeg ' . T_('is available.'));
             $res = true;
         }
     }
     if (!$res) {
         zmgToolboxPlugin::registerError('FFmpeg', T_('could not be detected on your system.'));
     }
     unset($output, $status);
 }
 function processMedium(&$medium, &$gallery)
 {
     $mime = $medium->getMimeType();
     zmgimport('org.zoomfactory.lib.mime.zmgMimeHelper');
     $ok = true;
     if (zmgMimeHelper::isImage($mime, true)) {
         zmgimport('org.zoomfactory.var.plugins.toolbox.tools.imageTool');
         $ok = zmgImageTool::process($medium, $gallery);
         if (!$ok) {
             zmgToolboxPlugin::registerError(T_('Upload medium'), T_('Could not create thumbnail of image file'));
             //TODO: cleanup
         }
     } else {
         if (zmgMimeHelper::isDocument($mime, true) && zmgMimeHelper::isIndexable($mime, true)) {
             zmgimport('org.zoomfactory.var.plugins.toolbox.tools.documentTool');
             $ok = zmgDocumentTool::process($medium, $gallery);
             if (!$ok) {
                 zmgToolboxPlugin::registerError(T_('Upload medium'), T_('Could not index document'));
                 //TODO: cleanup
             }
         } else {
             if (zmgMimeHelper::isVideo($mime, true) && zmgMimeHelper::isThumbnailable($mime, true)) {
                 zmgimport('org.zoomfactory.var.plugins.toolbox.tools.videoTool');
                 $ok = zmgVideoTool::process($medium, $gallery);
                 if (!$ok) {
                     zmgToolboxPlugin::registerError(T_('Upload medium'), T_('Could not create thumbnail of video file'));
                     //TODO: cleanup
                 }
             } else {
                 if (zmgMimeHelper::isAudio($mime, true)) {
                     zmgimport('org.zoomfactory.var.plugins.toolbox.tools.audioTool');
                     $ok = zmgAudioTool::process($medium, $gallery);
                     if (!$ok) {
                         zmgToolboxPlugin::registerError(T_('Upload medium'), T_('Audio file not supported'));
                         //TODO: cleanup
                     }
                 } else {
                     zmgToolboxPlugin::registerError(T_('Upload medium'), T_('Unsupported medium type.'));
                 }
             }
         }
     }
     return $ok;
 }