Файл: modules/obmen/inc/ff_48.php
Строк: 23
<?php
/* DCMS S (Special)
 * Версия файла 0.0.1
 * Дата последнего редактирования 14.11.2015
 * Модифицировал densnet
 */
if (class_exists('ffmpeg_movie')) {
    $media = new ffmpeg_movie($file['path']);
    $k_frame = intval($media->getFrameCount());
    $img_x = $media->GetFrameWidth();
    $img_y = $media->GetFrameHeight();
    $dstW = 48; #ширина
    if ($img_x == $img_y) {
        $dstH = 48; #высота
    } else {
        $dstH = ceil($dstW / $img_x * $img_y); #высота
    }
    $ff_frame = $media->getFrame(intval($k_frame / 2));
    if ($ff_frame) {
        $gd_image = $ff_frame->toGDImage();
        if ($gd_image) {
            $des_img = imagecreatetruecolor($dstW, $dstH);
            $s_img = $gd_image;
            imagecopyresampled($des_img, $s_img, 0, 0, 0, 0, $dstW, $dstH, $img_x, $img_y);
#наложение иконки на скрин
            if (is_file(H . ICONS_FILES . $file['ras'] . '.png')) {
                $imgi = imagecreatefrompng(H . ICONS_FILES . $file['ras'] . '.png');
                $imgi_x = imagesx($imgi);
                $imgi_y = imagesy($imgi);
                imagecopy($des_img, $imgi, $dstW - $imgi_x - 1, $dstH - $imgi_y - 1, 0, 0, $imgi_x, $imgi_y);
            }
            imagegif($des_img, $file['scr48']['gif']);
            @chmod($file['scr48']['gif'], 0777);
            imagedestroy($des_img);
            imagedestroy($s_img);
            $file['icon'] = "/sys/obmen/screens/width-48_$file[file_base64]-$file[size].gif";
        }
    }
}
if (!@$gd_image) {
    if (is_file(H . ICONS_FILES . $file['ras'] . '.png')) {
        @copy(H . ICONS_FILES . $file['ras'] . '.png', $file['scr14']['png']);
    } else {
        @copy(H . ICONS_FILES . 'file.png', $file['scr14']['png']);
    }
    @chmod($file['scr14']['png'], 0777);
    $file['icon'] = "/sys/obmen/screens/width-14_$file[file_base64]-$file[size].png";
}