Файл: modules/obmen/inc/icons.php
Строк: 76
<?php
/* DCMS S (Special)
* Версия файла 0.0.1
* Дата последнего редактирования 26.11.2015
* Модифицировал densnet
*/
#скрины шириной 48 px
$file['scr48']['gif'] = H . "sys/obmen/screens/width-48_$file[file_base64]-$file[size].gif";
$file['scr48']['jpg'] = H . "sys/obmen/screens/width-48_$file[file_base64]-$file[size].jpg";
$file['scr48']['png'] = H . "sys/obmen/screens/width-48_$file[file_base64]-$file[size].png";
#скрины шириной 14 px
$file['scr14']['gif'] = H . "sys/obmen/screens/width-14_$file[file_base64]-$file[size].gif";
$file['scr14']['jpg'] = H . "sys/obmen/screens/width-14_$file[file_base64]-$file[size].jpg";
$file['scr14']['png'] = H . "sys/obmen/screens/width-14_$file[file_base64]-$file[size].png";
if (file_exists($file['scr48']['gif'])) {
$file['icon'] = "/sys/obmen/screens/width-48_$file[file_base64]-$file[size].gif";
} elseif (file_exists($file['scr48']['jpg'])) {
$file['icon'] = "/sys/obmen/screens/width-48_$file[file_base64]-$file[size].jpg";
} elseif (file_exists($file['scr48']['png'])) {
$file['icon'] = "/sys/obmen/screens/width-48_$file[file_base64]-$file[size].png";
} elseif (file_exists($file['scr14']['gif'])) {
$file['icon'] = "/sys/obmen/screens/width-14_$file[file_base64]-$file[size].gif";
} elseif (file_exists($file['scr14']['jpg'])) {
$file['icon'] = "/sys/obmen/screens/width-14_$file[file_base64]-$file[size].jpg";
} elseif (file_exists($file['scr14']['png'])) {
$file['icon'] = "/sys/obmen/screens/width-14_$file[file_base64]-$file[size].png";
}
#скриншот для специфического файла
elseif (file_exists("inc/icons/$file[ras].php")) {
include "inc/icons/$file[ras].php";
} elseif (is_file($file['path'] . '.PNG') && $img_f = @imagecreatefrompng($file['path'] . '.PNG')) {
$img_x = imagesx($img_f);
$img_y = imagesy($img_f);
$dstW = 48; // ширина
if ($img_x == $img_y) {
$dstH = 48; #высота
} else {
$dstH = ceil($dstW / $img_x * $img_y); #высота
}
$screen48 = imagecreatetruecolor($dstW, $dstH);
imagecopyresampled($screen48, $img_f, 0, 0, 0, 0, $dstW, $dstH, $img_x, $img_y);
imagedestroy($img_f);
imagejpeg($screen48, $file['scr48']['jpg'], 95);
imagedestroy($screen48);
@chmod($file['scr48']['jpg'], 0777);
$file['icon'] = "/sys/obmen/screens/width-48_$file[file_base64]-$file[size].jpg";
} elseif (is_file($file['path'] . '.GIF') && $img_f = @imagecreatefromgif($file['path'] . '.GIF')) {
$img_x = imagesx($img_f);
$img_y = imagesy($img_f);
$dstW = 48; #ширина
if ($img_x == $img_y) {
$dstH = 48; #высота
} else {
$dstH = ceil($dstW / $img_x * $img_y); #высота
}
$screen48 = imagecreatetruecolor($dstW, $dstH);
imagecopyresampled($screen48, $img_f, 0, 0, 0, 0, $dstW, $dstH, $img_x, $img_y);
imagedestroy($img_f);
imagejpeg($screen48, $file['scr48']['jpg'], 95);
imagedestroy($screen48);
@chmod($file['scr48']['jpg'], 0777);
$file['icon'] = "/sys/obmen/screens/width-48_$file[file_base64]-$file[size].jpg";
} elseif (is_file($file['path'] . '.JPG') && $img_f = @imagecreatefromjpeg($file['path'] . '.JPG')) {
$img_x = imagesx($img_f);
$img_y = imagesy($img_f);
$dstW = 48; #ширина
if ($img_x == $img_y) {
$dstH = 48; #высота
} else {
$dstH = ceil($dstW / $img_x * $img_y); #высота
}
$screen48 = imagecreatetruecolor($dstW, $dstH);
imagecopyresampled($screen48, $img_f, 0, 0, 0, 0, $dstW, $dstH, $img_x, $img_y);
imagedestroy($img_f);
imagejpeg($screen48, $file['scr48']['jpg'], 95);
imagedestroy($screen48);
@chmod($file['scr48']['jpg'], 0777);
$file['icon'] = "/sys/obmen/screens/width-48_$file[file_base64]-$file[size].jpg";
} elseif (is_file(H . "style/icons/files/$file[ras].png")) {
$file['icon'] = "style/icons/files/$file[ras].png";
} else {
$file['icon'] = "/style/icons/file.png";
}