Вход Регистрация
Файл: user/files/screen_creators/videos.php
Строк: 99
<?php

/* Мод "Файлы"
 * Версия v0.0.1
 * Дата последнего редактирования 30.11.2014
 * Двиг DCMS Special
 * Модифицировал densnet
 * Файл images.php
 * Описание: работа с видео
 */

$movie = new ffmpeg_movie($filee);
if (!
$movie) {
    
$imgc = imagecreatefromstring(file_get_contents(H . "style/images/no_prevjushka_big.png"));
    
$img_x = imagesx($imgc);
    
$img_y = imagesy($imgc);
    if (
$img_x == $img_y) {
        
$dstW = 200; // ширина
        
$dstH = 200; // высота 
    
} elseif ($img_x > $img_y) {
        
$prop = $img_x / $img_y;
        
$dstW = 200;
        
$dstH = ceil($dstW / $prop);
    } else {
        
$prop = $img_y / $img_x;
        
$dstH = 200;
        
$dstW = ceil($dstH / $prop);
    }
    
$screen = imagecreatetruecolor($dstW, $dstH);
    
$black = imagecolorallocate($screen, 0, 0, 0);
//imagecolortransparent($screen,$black);
    
imagecopyresampled($screen, $imgc, 0, 0, 0, 0, $dstW, $dstH, $img_x, $img_y);
    
imagedestroy($imgc);
    
imagepng($screen, H . "user/files/screens/" . $id_file . "_big.png");
    
chmod(H . "user/files/screens/" . $id_file . "_big.png", 0777);
    
imagedestroy($screen);
    
$imgc = imagecreatefromstring(file_get_contents(H . "style/images/no_prevjushka.png"));
    
$img_x = imagesx($imgc);
    
$img_y = imagesy($imgc);
    if (
$img_x == $img_y) {
        
$dstW = 80; // ширина
        
$dstH = 80; // высота 
    
} elseif ($img_x > $img_y) {
        
$prop = $img_x / $img_y;
        
$dstW = 80;
        
$dstH = ceil($dstW / $prop);
    } else {
        
$prop = $img_y / $img_x;
        
$dstH = 80;
        
$dstW = ceil($dstH / $prop);
    }
    
$screen = imagecreatetruecolor($dstW, $dstH);
    
$black = imagecolorallocate($screen, 0, 0, 0);
//imagecolortransparent($screen,$black);
    
imagecopyresampled($screen, $imgc, 0, 0, 0, 0, $dstW, $dstH, $img_x, $img_y);
    
imagedestroy($imgc);
    
imagepng($screen, H . "user/files/screens/$id_file.png");
    
chmod(H . "user/files/screens/$id_file.png", 0777);
    
imagedestroy($screen);
    
/*
      copy(H."style/images/no_prevjushka_big.png",H."files/screens/".$id_file."_big.png");
      chmod(H."files/screens/".$id_file."_big.png", 0777);
      copy(H."style/images/no_prevjushka.png",H."files/screens/$id_file.png");
      chmod(H."files/screens/$id_file.png", 0777);
     */
} else {
    
$k_frames = $movie->getFrameCount();
    for (
$kp = 1; $kp <= 60; $kp++) {
        
$image = $movie->getFrame($kp);
        if (!
$image) {
            
        } else
            
$show_img = $image->toGDImage();
    }
    if (
$show_img) {
        
imagepng($show_img, H . "user/files/screens/$id_file.png");
        
chmod(H . "user/files/screens/$id_file.png", 0777);
        
$imgc = imagecreatefromstring(file_get_contents(H . "user/files/screens/$id_file.png"));
        
$img_x = imagesx($imgc);
        
$img_y = imagesy($imgc);
        if (
$img_x == $img_y) {
            
$dstW = 80; // ширина
            
$dstH = 80; // высота 
        
} elseif ($img_x > $img_y) {
            
$prop = $img_x / $img_y;
            
$dstW = 80;
            
$dstH = ceil($dstW / $prop);
        } else {
            
$prop = $img_y / $img_x;
            
$dstH = 80;
            
$dstW = ceil($dstH / $prop);
        }
        
$screen = imagecreatetruecolor($dstW, $dstH);
        
$black = imagecolorallocate($screen, 0, 0, 0);
//imagecolortransparent($screen,$black);
        
imagecopyresampled($screen, $imgc, 0, 0, 0, 0, $dstW, $dstH, $img_x, $img_y);
        
imagedestroy($imgc);
        
imagepng($screen, H . "user/files/screens/$id_file.png");
        
chmod(H . "user/files/screens/$id_file.png", 0777);
        
imagedestroy($screen);

        
imagepng($show_img, H . "user/files/screens/" . $id_file . "_big.png");
        
chmod(H . "user/files/screens/" . $id_file . "_big.png", 0777);
        
imagedestroy($show_img);
        
$imgc = imagecreatefromstring(file_get_contents(H . "user/files/screens/" . $id_file . "_big.png"));
        
$img_x = imagesx($imgc);
        
$img_y = imagesy($imgc);
        if (
$img_x == $img_y) {
            
$dstW = 200; // ширина
            
$dstH = 200; // высота 
        
} elseif ($img_x > $img_y) {
            
$prop = $img_x / $img_y;
            
$dstW = 200;
            
$dstH = ceil($dstW / $prop);
        } else {
            
$prop = $img_y / $img_x;
            
$dstH = 200;
            
$dstW = ceil($dstH / $prop);
        }
        
$screen = imagecreatetruecolor($dstW, $dstH);
        
$black = imagecolorallocate($screen, 0, 0, 0);
//imagecolortransparent($screen,$black);
        
imagecopyresampled($screen, $imgc, 0, 0, 0, 0, $dstW, $dstH, $img_x, $img_y);
        
imagedestroy($imgc);
        
imagepng($screen, H . "user/files/screens/" . $id_file . "_big.png");
        
chmod(H . "user/files/screens/" . $id_file . "_big.png", 0777);
        
imagedestroy($screen);
    }
}
Онлайн: 2
Реклама