= 352 && $deviceHeight >= 288 ) $videoSize = "352x288"; elseif ( $deviceWidth >= 176 && $deviceHeight >= 144 ) $videoSize = "176x144"; else $videoSize = "128x96"; $eventWidth = $event['Width']; $eventHeight = $event['Height']; if ( !isset( $rate ) ) $_REQUEST['rate'] = reScale( RATE_BASE, $event['DefaultRate'], ZM_WEB_DEFAULT_RATE ); $eventPath = ZM_DIR_EVENTS.'/'.getEventPath( $event ); $videoFormats = array(); $ffmpegFormats = preg_split( '/\s+/', ZM_FFMPEG_FORMATS ); foreach ( $ffmpegFormats as $ffmpegFormat ) { preg_match( '/^([^*]+)(\**)$/', $ffmpegFormat, $matches ); $videoFormats[$matches[1]] = $matches[1]; if ( $matches[2] == '*' ) $defaultVideoFormat = $matches[1]; elseif ( $matches[2] == '**' ) $defaultPhoneFormat = $matches[1]; } if ( !isset($_REQUEST['videoFormat']) ) { if ( isset($defaultPhoneFormat) ) $_REQUEST['videoFormat'] = $defaultPhoneFormat; elseif ( isset($defaultVideoFormat) ) $_REQUEST['videoFormat'] = $defaultVideoFormat; else $videoFormat = $ffmpegFormats[0]; } if ( !empty($_REQUEST['generate']) ) { $videoFile = createVideo( $event, $_REQUEST['videoFormat'], $_REQUEST['rate'], $videoSize, !empty($_REQUEST['overwrite']) ); } $videoFiles = array(); if ( $dir = opendir( $eventPath ) ) { while ( ($file = readdir( $dir )) !== false ) { $file = $eventPath.'/'.$file; if ( is_file( $file ) ) { if ( preg_match( '/-S([\da-z]+)\.(?:'.join( '|', $videoFormats ).')$/', $file, $matches ) ) { if ( $matches[1] == $videoSize ) { $videoFiles[] = $file; } } } } closedir( $dir ); } if ( isset($_REQUEST['download']) ) { header( "Content-type: ".getMimeType($videoFiles[$_REQUEST['download']])); header( "Content-length: ".filesize($videoFiles[$_REQUEST['download']])); header( "Content-disposition: attachment; filename=".preg_replace( "/^.*\//", "", $videoFiles[$_REQUEST['download']] )."; size=".filesize($videoFiles[$_REQUEST['download']]) ); readfile( $videoFiles[$_REQUEST['download']] ); exit; } xhtmlHeaders( __FILE__, translate('Video').' - '.$event['Name'] ); ?>