Файл: inc_files/video.php
Строк: 107
<?php
/**
 * @author [FaNiska]
 * @copyright 2009
 * Загруз центр
 * Предложения, идеи, вопросы и об ошибках писать в icq 65-64-538 или на mobi-m-ru@ya.ru
 */
$sess = rand(0, 1000);
if (!empty($file_info['about']))
{
    echo "<div> Описание:<br />$file_info[about]</div>";
} else
{ /// Если нет описания, проверяем его в текстовых файлах.
    $path = eregi_replace($f_ras.'$', '', $file_info['s_name']);
    if (is_file($path . 'txt'))
    {
        $file_info['about'] = txt_out_dc(file_get_contents($path . 'txt'));
    } elseif (is_file($path . 'TXT'))
    {
        $file_info['about'] = txt_out_dc(file_get_contents($path . 'TXT'));
    } elseif (is_file($path . 'opis'))
    {
        $file_info['about'] = txt_out_dc(file_get_contents($path . 'opis'));
    } elseif (is_file($path . 'OPIS'))
    {
        $file_info['about'] = txt_out_dc(file_get_contents($path . 'OPIS'));
    } elseif (is_file('about/' . $path . 'opis'))
    {
        $file_info['about'] = txt_out_dc(file_get_contents('about/' . $path . 'opis'));
    } elseif (is_file('about/' . $path . 'txt'))
    {
        $file_info['about'] = txt_out_dc(file_get_contents('about/' . $path . 'txt'));
    }
    if (!empty($file_info['about']))
    {
        echo "<div> Описание:<br />$file_info[about]</div>";
        mysql_query("UPDATE `$table` SET `about`=" . quote_smart($file_info['about']) . " WHERE `id`='" . $file_info['id'] .
        "' LIMIT 1");
    }
    
}
$screenshot = str_replace($f_ras, '', $file_name);
$screenshot = $file_info['folder'] . '/' . $screenshot . 'GIF';
echo '<div>';
if (is_file($screenshot))
{
    echo 'Скриншот<br />';
    if (function_exists('iconv'))
        echo "<img src='" . iconv('windows-1251', 'utf-8', "$screenshot") . "' alt='скачать $name $f_ras' /><br />n";
    else
        echo "<img src='$screenshot' alt='скачать $name $f_ras' /><br />n";
} elseif (class_exists('ffmpeg_movie'))
{
    $media = new ffmpeg_movie(realpath($file_info['s_name']));
    $k_frame = valid_int($media->getFrameCount());
    $w = $media->GetFrameWidth();
    $h = $media->GetFrameHeight();
    if ($setup['k_kadr'] != null && $setup['k_kadr'] != 0)
    {
        $k_kadr = intval($setup['k_kadr']);
    } else
    {
        $k_kadr = 5;
    }
    for ($i = 0; $i < $k_kadr; $i++)
    {
        $ff_frame = $media->getFrame(intval($k_frame / ($k_kadr / ($i + 1))));
        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);
                if ($setup['mark_set'] == 1)
                {
                    $des_img=img_copyright($des_img); // копирайт
                }
                $frames[$i] = "temp/frame_$sess.$i.gif";
                imagegif($des_img, $frames[$i]);
                chmod($frames[$i], 0777);
                $framed[$i] = 60;
                imagedestroy($des_img);
                imagedestroy($s_img);
            }
        }
    }
    include_once 'inc/gifencoder.php';
    $gif = @new GIFEncoder($frames, $framed, 0, 2, 0, 0, 0, "url");
    $screen = $gif->GetAnimation();
    file_put_contents("$screenshot", $screen);
    @chmod("$screenshot", 0777);
    for ($i = 0; $i < $k_kadr; $i++)
    {
        unlink("temp/frame_$sess.$i.gif");
    }
    if ($screen != null)
    {
        echo 'Скриншот<br />';
        if (function_exists('iconv'))
            echo "<img src='" . iconv('windows-1251', 'utf-8', "$screenshot") . "' alt='скачать $name $f_ras' /><br />n";
        else
            echo "<img src='$screenshot' alt='скачать $name $f_ras' /><br />n";
    }
}
echo '<img src='ext/' . $f_ras . '.gif' alt='+' width='16' height='16'/> Скачать видео ' . $file_info['f_ras'] .
    ':<br /><a href="load.php?c=' . $table . '&id=' . $id . '">' . $name . ' ' . $f_ras . '</a><br/>';
if (class_exists('ffmpeg_movie'))
{
    $media = new ffmpeg_movie(realpath($file_info['s_name']));
    echo 'Разрешение: ' . $media->GetFrameWidth() . 'x' . $media->GetFrameHeight() . "пикс<br />n";
    echo 'Частота кадров: ' . $media->getFrameRate() . "<br />n";
    echo 'Кодек (видео): ' . $media->getVideoCodec() . "<br />n";
    if (valid_int($media->getDuration()) > 3599)
        echo 'Время: ' . valid_int($media->getDuration() / 3600) . ":" . date('s', fmod($media->getDuration() / 60, 60)) . ":" .
            date('s', fmod($media->getDuration(), 3600)) . "<br />n";
    elseif (valid_int($media->getDuration()) > 59)
        echo 'Время: ' . valid_int($media->getDuration() / 60) . ":" . date('s', fmod($media->getDuration(), 60)) . "<br />n";
    else
        echo 'Время: ' . valid_int($media->getDuration()) . " сек<br />n";
    echo "Битрейт: " . ceil(($media->getBitRate()) / 1024) . " KBPS<br />n";
}
echo '</div>';
?>