| Server IP : 103.82.32.14 / Your IP : 216.73.217.121 Web Server : Apache/2.2.32 (Unix) mod_ssl/2.2.32 OpenSSL/1.0.1e-fips mod_fcgid/2.3.9 System : Linux cloud.lonmanhoabinh.com 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : lonmakmf ( 524) PHP Version : 5.6.30 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /home/forumhet/public_html/users/ |
Upload File : |
<?php
/*
////////////////////////////////////////////////////////////////////////////////
// JohnCMS Mobile Content Management System //
// Project site: http://johncms.com //
// Support site: http://gazenwagen.com //
////////////////////////////////////////////////////////////////////////////////
// Lead Developer: Oleg Kasyanov (AlkatraZ) alkatraz@gazenwagen.com //
// Development Team: Eugene Ryabinin (john77) john77@gazenwagen.com //
// Dmitry Liseenko (FlySelf) flyself@johncms.com //
////////////////////////////////////////////////////////////////////////////////
*/
//TODO: Поставить настраиваемый по вызову (через ссылку) размер изображений
function format($name) {
$f1 = strrpos($name, ".");
$f2 = substr($name, $f1 + 1, 999);
$fname = strtolower($f2);
return $fname;
}
$u = isset($_GET['u']) ? abs(intval($_GET['u'])) : NULL;
$file = isset($_GET['f']) ? htmlspecialchars(urldecode($_GET['f'])) : NULL;
if ($u && $file && file_exists('../files/users/album/' . $u . '/' . $file)) {
$att_ext = strtolower(format('../files/users/album/' . $u . '/' . $file));
$pic_ext = array (
'gif',
'jpg',
'jpeg',
'png'
);
if (in_array($att_ext, $pic_ext)) {
$sizs = GetImageSize('../files/users/album/' . $u . '/' . $file);
$razm = 230;
$width = $sizs[0];
$height = $sizs[1];
$x_ratio = $razm / $width;
$y_ratio = $razm / $height;
if (($width <= $razm) && ($height <= $razm)) {
$tn_width = $width;
$tn_height = $height;
} else if (($x_ratio * $height) < $razm) {
$tn_height = ceil($x_ratio * $height);
$tn_width = $razm;
} else {
$tn_width = ceil($y_ratio * $width);
$tn_height = $razm;
}
switch ($att_ext) {
case "gif":
$im = ImageCreateFromGIF('../files/users/album/' . $u . '/' . $file);
break;
case "jpg":
$im = ImageCreateFromJPEG('../files/users/album/' . $u . '/' . $file);
break;
case "jpeg":
$im = ImageCreateFromJPEG('../files/users/album/' . $u . '/' . $file);
break;
case "png":
$im = ImageCreateFromPNG('../files/users/album/' . $u . '/' . $file);
break;
}
$im1 = imagecreatetruecolor($tn_width, $tn_height);
imagecopyresized($im1, $im, 0, 0, 0, 0, $tn_width, $tn_height, $width, $height);
// Передача изображения в Браузер
ob_start();
imageJpeg($im1, NULL, 60);
ImageDestroy($im);
imagedestroy($im1);
header('Content-Type: image/jpeg');
header('Content-Disposition: inline; filename=thumbinal.jpg');
header('Content-Length: ' . ob_get_length());
ob_end_flush();
}
}
?>