Вход Регистрация
Файл: modules/obmen/inc/icons/png.php
Строк: 18
<?php

if (USE_GD) {
    
$imgc = imagecreatefrompng($file['path']);
    
$img_x = imagesx($imgc);
    
$img_y = imagesy($imgc);
    
$dstW = 48; #ширина

    
if ($img_x == $img_y) {
        
$dstH = 48; #высота
    
} else {
        
$dstH = ceil($dstW / $img_x * $img_y); #высота
    
}

    
$screen = imagecreatetruecolor($dstW, $dstH);

    
imagecopyresampled($screen, $imgc, 0, 0, 0, 0, $dstW, $dstH, $img_x, $img_y);
    
imagedestroy($imgc);
    
imagepng($screen, $file['scr48']['png']);
    @
chmod($file['scr48']['png'], 0777);
    
imagedestroy($screen);

    
$file['icon'] = "/sys/obmen/screens/width-48_$file[file_base64]-$file[size].png";
} elseif (
is_file(H . ICONS_FILES . $file['ras'] . '.png')) {
    
$file['icon'] = ICONS_FILES . $file['ras'] . '.png';
} else {
    
$file['icon'] = ICONS_FILES . 'file.png';
}
Онлайн: 2
Реклама