Файл: modules/diary/inc/create_image.php
Строк: 122
<?php
/* Мод "Блоги"
* Версия v0.0.1
* Дата последнего редактирования 07.04.2015
* Двиг DCMS Special
* Модифицировал densnet
* Автор неизвестно
* Файл create_image.php
* Описание:
*/
require_once '../../../sys/inc/start.php';
require_once H . 'sys/inc/sess.php';
require_once H . 'sys/inc/settings.php';
require_once H . 'sys/inc/db_connect.php';
require_once H . 'sys/inc/ipua.php';
require_once H . 'sys/inc/fnc.php';
require_once H . 'sys/inc/user.php';
$movie = @new ffmpeg_movie(H . "modules/diary/files/" . intval($_GET['file']) . ".dat");
$name = $_GET['name'];
$fid = intval($_GET['file']);
$imname = "image.f" . $fid . ".80.80.png";
$icname = "icon.f" . $fid . ".16.16.png";
if ($imgc = imagecreatefromstring(file_get_contents(H . "modules/diary/files/" . intval($_GET['file']) . ".dat")) && $name == $imname) {
header("Content-type: image/png");
$imgc = imagecreatefromstring(file_get_contents(H . "modules/diary/files/" . intval($_GET['file']) . ".dat"));
$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);
imagedestroy($screen);
} elseif ($movie && $name == $imname) {
$k_frames = $movie->getFrameCount(); //к-тво кадров
for ($kp = 1; $kp <= 60; $kp++) { //выбираем случайный кадр
$image = $movie->getFrame($kp);
if ($image)
$show_img = $image->toGDImage(); //если кадр в нормальном состоянии, то выбираем его для дальнейшей работы
}
if ($show_img) {
$imgc = $show_img;
$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);
// и выводим его в браузер
header("Content-type: image/png");
imagepng($screen);
imagedestroy($screen);
#Систему переделал Killer (Special For New DiaryMod)
#Редактировал densnet
}
} elseif ($zip = new PclZip(H . "modules/diary/files/" . intval($_GET['file']) . ".dat")) {
if ($name == $icname) {
$content = $zip->extract(PCLZIP_OPT_BY_NAME, "META-INF/MANIFEST.MF", PCLZIP_OPT_EXTRACT_AS_STRING);
if ($content[0]['content'] == NULL) {
$content = $zip->extract(PCLZIP_OPT_BY_NAME, "META-INF/manifest.mf", PCLZIP_OPT_EXTRACT_AS_STRING);
}
$icon = false;
if (@eregi("MIDlet-Icon:[^(n|r)]*(n|r)", $content[0]['content'], $jad)) {
$icon = eregi_replace("(MIDlet-Icon:( )*)|(n|r)", NULL, $jad[0]);
} elseif (@eregi("MIDlet-1:[^(n|r)]*(n|r)", $content[0]['content'], $jad)) {
$icon = eregi_replace("(MIDlet-1:( )*)|(n|r)", NULL, $jad[0]);
$icon = eregi_replace("(^[^,]*,)|(,[^,]*$)", NULL, $icon);
}
$icon = eregi_replace('^ *| *$', NULL, $icon);
$icon = ereg_replace("(^(/){1,})|((/){1,}$)", "", $icon);
//echo $icon;
if ($icon == NULL)
$icon = false;
if ($icon) {
$content = $zip->extract(PCLZIP_OPT_BY_NAME, $icon, PCLZIP_OPT_EXTRACT_AS_STRING);
header("Content-type: image/png");
echo $content[0]['content'];
}
} else {
echo "Хакир?!";
}
} else {
echo "Хакир?!";
}