|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /home/queenjbs/www/gallary/ |
Upload File : |
<?
$image = $vName;
if($image) {
$img_size = GetImageSize("../files/board/".$image);
$x = $img_size[0];
$y = $img_size[1];
}
$re_imgX = 100;
$re_imgY = ($y * 100) / $x;
$thumbWidth = "$re_imgX"; //-- À̹ÌÁö Å©±â
$thumbHeigth = "$re_imgY";
$thumbQuality = "100"; //--À̹ÌÁö Áú
$ext = strrchr($image,".");
$ext = substr($ext,1);
if($ext == "jpg" or $ext == "jpeg") {
//header("Content-type: image/jpeg");
$origImageHandle = imagecreatefromjpeg("../files/board/".$image);
}elseif($ext == "gif"){
//header("Content-type: image/gif");
$origImageHandle = imagecreatefromgif("../files/board/".$image);
}
$thumbImageHandle = imagecreatetruecolor("$thumbWidth","$thumbHeigth");
imagecopyresampled($thumbImageHandle,$origImageHandle,0,0,0,0,$thumbWidth,$thumbHeigth,imagesx($origImageHandle),imagesy($origImageHandle));
$thembfile = "../files/board/sontop/".$vName;
if($ext == "jpg" or $ext == "jpeg"){
//echo $thembfile;
imagejpeg($thumbImageHandle,$thembfile,"$thumbQuality");
}elseif($ext == "gif"){
imagegif($thumbImageHandle,$thembfile,"$thumbQuality");
}
?>
<?
$image = $vName;
if($image) {
$img_size = GetImageSize("../files/board/".$image);
$x = $img_size[0];
$y = $img_size[1];
}
$re_imgX = 100;
$re_imgY = ($y * 100) / $x;
$thumbWidth = "$re_imgX"; //-- À̹ÌÁö Å©±â
$thumbHeigth = "$re_imgY";
//Ãß°¡
if($thumbWidth * $y < $thumbHeigth * $x)
{
// ¿øº» À̹ÌÁöÀÇ °¡·ÎÅ©±â°¡ ÁöÁ¤ ºñÀ²º¸´Ù Å©´Ù.
$thumbWidth = round($y * ($thumbWidth / $thumbHeigth));
$thumbHeigth = $y;
// ÀÚ¸¦ ½ÃÀÛ x,yÁÂÇ¥
$sc_x = round(($x - $thumbWidth) / 2);
$sc_y = 0;
}
else
{
// ¿øº» À̹ÌÁöÀÇ ¼¼·ÎÅ©±â°¡ ÁöÁ¤ ºñÀ²º¸´Ù Å©´Ù.
$thumbWidth = $x;
$thumbHeigth = round($x * ($thumbHeigth / $thumbWidth));
// ÀÚ¸¦ ½ÃÀÛ x,yÁÂÇ¥
$sc_x = 0;
$sc_y = round(($y - $thumbHeigth) / 5);
}
$rs_x =0;
$rs_y =0;
//Ãß°¡ ³¡
$thumbQuality = "100"; //--À̹ÌÁö Áú
$ext = strrchr($image,".");
$ext = substr($ext,1);
if($ext == "jpg" or $ext == "jpeg") {
//header("Content-type: image/jpeg");
$origImageHandle = imagecreatefromjpeg("../files/board/".$image);
}elseif($ext == "gif"){
//header("Content-type: image/gif");
$origImageHandle = imagecreatefromgif("../files/board/".$image);
}
$thumbImageHandle = imagecreatetruecolor("$thumbWidth","$thumbHeigth");
imagecopyresampled($thumbImageHandle,$origImageHandle,$rs_x,$rs_y,$sc_x,$sc_y,$thumbWidth,$thumbHeigth,imagesx($origImageHandle),imagesy($origImageHandle));
$thembfile = "../files/board/sontop/".$vName;
if($ext == "jpg" or $ext == "jpeg"){
//echo $thembfile;
imagejpeg($thumbImageHandle,$thembfile,"$thumbQuality");
}elseif($ext == "gif"){
imagegif($thumbImageHandle,$thembfile,"$thumbQuality");
}
imagedestroy($origImageHandle);
?>