Файл: modules/obmen/inc/icons.php
Строк: 83
<?php
#скрины шириной 48 px
$file['scr48']['gif'] = H . 'sys/obmen/screens/width-48_' . $file['file_base64'] . $set['set_them'] . $file['size'] . '.gif';
$file['scr48']['jpg'] = H . 'sys/obmen/screens/width-48_' . $file['file_base64'] . $set['set_them'] . $file['size'] . '.jpg';
$file['scr48']['png'] = H . 'sys/obmen/screens/width-48_' . $file['file_base64'] . $set['set_them'] . $file['size'] . '.png';
#скрины шириной 14 px
$file['scr14']['gif'] = H . 'sys/obmen/screens/width-14_' . $file['file_base64'] . $set['set_them'] . $file['size'] . '.gif';
$file['scr14']['jpg'] = H . 'sys/obmen/screens/width-14_' . $file['file_base64'] . $set['set_them'] . $file['size'] . '.jpg';
$file['scr14']['png'] = H . 'sys/obmen/screens/width-14_' . $file['file_base64'] . $set['set_them'] . $file['size'] . '.png';
if (file_exists($file['scr48']['gif'])) {
$file['icon'] = "/sys/obmen/screens/width-48_$file[file_base64]" . $set['set_them'] . "$file[size].gif";
} elseif (file_exists($file['scr48']['jpg'])) {
$file['icon'] = "/sys/obmen/screens/width-48_$file[file_base64]" . $set['set_them'] . "$file[size].jpg";
} elseif (file_exists($file['scr48']['png'])) {
$file['icon'] = "/sys/obmen/screens/width-48_$file[file_base64]" . $set['set_them'] . "$file[size].png";
} elseif (file_exists($file['scr14']['gif'])) {
$file['icon'] = "/sys/obmen/screens/width-14_$file[file_base64]" . $set['set_them'] . "$file[size].gif";
} elseif (file_exists($file['scr14']['jpg'])) {
$file['icon'] = "/sys/obmen/screens/width-14_$file[file_base64]" . $set['set_them'] . "$file[size].jpg";
} elseif (file_exists($file['scr14']['png'])) {
$file['icon'] = "/sys/obmen/screens/width-14_$file[file_base64]" . $set['set_them'] . "$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);
#наложение иконки на скрин
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($screen48, $imgi, $dstW - $imgi_x - 1, $dstH - $imgi_y - 1, 0, 0, $imgi_x, $imgi_y);
imagedestroy($imgi);
}
imagejpeg($screen48, $file['scr48']['jpg'], 95);
imagedestroy($screen48);
@chmod($file['scr48']['jpg'], 0777);
$file['icon'] = "/sys/obmen/screens/width-48_$file[file_base64]" . $set['set_them'] . "$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);
#наложение иконки на скрин
if (is_file(H . 'style/img/files/' . $file['ras'] . '.png')) {
$imgi = imagecreatefrompng(H . 'style/img/files/' . $file['ras'] . '.png');
$imgi_x = imagesx($imgi);
$imgi_y = imagesy($imgi);
imagecopy($screen48, $imgi, $dstW - $imgi_x - 1, $dstH - $imgi_y - 1, 0, 0, $imgi_x, $imgi_y);
imagedestroy($imgi);
}
imagejpeg($screen48, $file['scr48']['jpg'], 95);
imagedestroy($screen48);
@chmod($file['scr48']['jpg'], 0777);
$file['icon'] = "/sys/obmen/screens/width-48_$file[file_base64]" . $set['set_them'] . "$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);
#наложение иконки на скрин
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($screen48, $imgi, $dstW - $imgi_x - 1, $dstH - $imgi_y - 1, 0, 0, $imgi_x, $imgi_y);
imagedestroy($imgi);
}
imagejpeg($screen48, $file['scr48']['jpg'], 95);
imagedestroy($screen48);
@chmod($file['scr48']['jpg'], 0777);
$file['icon'] = "/sys/obmen/screens/width-48_$file[file_base64]" . $set['set_them'] . "$file[size].jpg";
} elseif (is_file(H ."style/img/files/$file[ras].png")) {
$file['icon'] = "style/img/files/$file[ras].png";
} else {
$file['icon'] = "/style/img/file.png";
}