<?
if (stristr($_SERVER['HTTP_USER_AGENT'],'windows') || stristr($_SERVER['HTTP_USER_AGENT'],'linux') || 
    stristr($_SERVER['HTTP_USER_AGENT'],'macintosh') || stristr($_SERVER['HTTP_USER_AGENT'],'unix') || 
    stristr($_SERVER['HTTP_USER_AGENT'],'macos') || stristr($_SERVER['HTTP_USER_AGENT'],'bsd')){
$pred_file=H.'files/user_files/'.$file_id['id'].'.dat';
if (is_file(H."files/prev/video/$file_id[id].flv")){
echo"<script type='text/javascript' src='http://vdrugbe.ru/sys/swfobject.js'></script>
<div id='mediaspace'>This text will be replaced</div>
<script type='text/javascript'>var so = new SWFObject('http://vdrugbe.ru/sys/flvplayer.swf','ply','470','320','9','#ffffff');
so.addParam('allowfullscreen','true');so.addParam('allowscriptaccess','always');so.addParam('wmode','opaque');
so.addVariable('file','http://vdrugbe.ru/files/prev/video/".$file_id['id'].".flv');
so.addVariable('image','');
so.write('mediaspace');</script>";
}elseif (!@copy($pred_file, H."files/prev/video/$file_id[id].flv"))
{}else{
echo"<script type='text/javascript' src='http://vdrugbe.ru/sys/swfobject.js'></script>
<div id='mediaspace'>This text will be replaced</div>
<script type='text/javascript'>var so = new SWFObject('http://vdrugbe.ru/sys/flvplayer.swf','ply','470','320','9','#ffffff');
so.addParam('allowfullscreen','true');so.addParam('allowscriptaccess','always');so.addParam('wmode','opaque');
so.addVariable('file','http://vdrugbe.ru/files/prev/video/".$file_id['id'].".flv');
so.addVariable('image','');
so.write('mediaspace');</script>";
}}
if (is_file(H."files/user_files/screens/$file_id[id].gif"))
{
echo "<img src='/files/user_files/screens/$file_id[id].gif' alt='scr...' /><br />\n";
}
elseif (class_exists('ffmpeg_movie')){
$media = new ffmpeg_movie($file);
$k_frame=intval($media->getFrameCount());

$w = $media->GetFrameWidth();
$h = $media->GetFrameHeight();
$ff_frame = $media->getFrame(intval($k_frame/2));
if ($ff_frame) {
$gd_image = $ff_frame->toGDImage();
if ($gd_image) {
$des_img = imagecreatetruecolor(128, 128);
$s_img = $gd_image;
imagecopyresampled($des_img, $s_img, 0, 0, 0, 0, 128, 128, $w, $h);
$des_img=img_copyright($des_img); // наложение копирайта
imagegif($des_img,H."files/user_files/screens/$file_id[id].gif");
chmod(H."files/user_files/screens/$file_id[id].gif", 0777);
imagedestroy($des_img);
imagedestroy($s_img);




if (function_exists('iconv'))
echo "<img src='".iconv('windows-1251', 'utf-8',"/files/user_files/screens/$file_id[id].gif")."' alt='scr...' /><br />\n";
else
echo "<img src='/files/user_files/screens/$file_id[id].gif' alt='scr...' /><br />\n";

}
}
}

if ($file_id['opis']!=NULL)
{

echo trim(br(links($file_id['opis'])));

echo "<br />\n";
}

if (class_exists('ffmpeg_movie')){
$media = new ffmpeg_movie($file);

echo 'Разрешение: '. $media->GetFrameWidth().'x'.$media->GetFrameHeight()."пикс<br />\n";
echo 'Частота кадров: '.$media->getFrameRate()."<br />\n";
echo 'Кодек (видео): '.$media->getVideoCodec()."<br />\n";

if (intval($media->getDuration())>3599)
echo 'Время: '.intval($media->getDuration()/3600).":".date('s',fmod($media->getDuration()/60,60)).":".date('s',fmod($media->getDuration(),3600))."<br />\n";
elseif (intval($media->getDuration())>59)
echo 'Время: '.intval($media->getDuration()/60).":".date('s',fmod($media->getDuration(),60))."<br />\n";
else
echo 'Время: '.intval($media->getDuration())." сек<br />\n";
echo "Битрейт: ".ceil(($media->getBitRate())/1024)." KBPS<br />\n";

}


?>
