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

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

$imgc = imagecreatefromstring(file_get_contents($filee));
if (!
$imgc) {
    
$imgc = imagecreatefromstring(file_get_contents(H . "style/img/file.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 . "sys/files/screens/" . $id_file . "_big.png");
    
chmod(H . "sys/files/screens/" . $id_file . "_big.png", 0777);
    
imagedestroy($screen);
    
$imgc = imagecreatefromstring(file_get_contents(H . "style/img/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 . "sys/files/screens/$id_file.png");
    
chmod(H . "sys/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 . "sys/files/screens/" . $id_file . "_big.png", 0777);
    
copy(H . "style/images/no_prevjushka.png", H . "files/screens/$id_file.png");
    
chmod(H . "sys/files/screens/$id_file.png", 0777);
} else {
    
$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 . "sys/files/screens/$id_file.png");
    
chmod(H . "sys/files/screens/$id_file.png", 0777);
    
imagedestroy($screen);

    
$imgc = imagecreatefromstring(file_get_contents($filee));
    
$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);
    
$screen = img_copyright($screen); // наложение копирайта
    
imagepng($screen, H . "sys/files/screens/" . $id_file . "_big.png");
    
chmod(H . "sys/files/screens/" . $id_file . "_big.png", 0777);
    
imagedestroy($screen);
}
Онлайн: 2
Реклама