require "config.php";
include "class/thumnail.php"; // ½æ³×ÀÏ ÇÔ¼ö ·Îµå
include "class/thumnail_jpg.php"; // ½æ³×ÀÏ ÇÔ¼ö ·Îµå
$mode=trim($mode);
switch($mode) {
case addimg:
// À̹ÌÁö Ãß°¡
if($upload_file!="none") {
$pass=$upload_pass;
$code=time();
$file_ext=strtolower(substr(strrchr($upload_file_name,"."),1));
if($file_ext=="jpg" || $file_ext=="gif") {
// À̹ÌÁö À̸§ ÁöÁ¤
$ap="${code}.${file_ext}";
$ap2="$pass/$ap";
$src="$upload_pass_http/$ap";
// À̹ÌÁö ÀúÀå
copy($upload_file,$ap2);
chmod($ap2,0777);
// ÁöÁ¤Å©±âº¸´Ù Ŭ¶§´Â ½æ³×ÀÏ ¸¸µé±â
/*
$aps="s1_${code}.${file_ext}";
$aps2=$pass."/s1_${code}.${file_ext}";
$x=80;
$y=60;
if($file_ext=="gif") imagegif(thumbnail($ap2,$x,$y),$aps2);
elseif($file_ext=="jpg") {
$duty_thumb = new DutyThumb();
$duty_thumb->init("${pass}",$ap);
$duty_thumb->Create($pass,$aps,$x,$y);
$duty_thumb->Destroy();
*/
// À̹ÌÁö ¸®½ºÆ®¿¡ Ãß°¡
echo "
";
}
else error("ERROR >> À̹ÌÁö´Â JPG ¶Ç´Â GIF Çü½Ä¸¸ Áö¿øÇÕ´Ï´Ù.");
}
else error("ERROR >> À̹ÌÁö¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
break;
case addimgedit:
// À̹ÌÁö Ãß°¡ ¼öÁ¤
if($upload_file!="none") {
$pass=$upload_pass;
$code=time();
$file_ext=strtolower(substr(strrchr($upload_file_name,"."),1));
if($file_ext=="jpg" || $file_ext=="gif") {
// À̹ÌÁö À̸§ ÁöÁ¤
$ap="${code}.${file_ext}";
$ap2="$pass/$ap";
$src="$upload_pass_http/$ap";
// À̹ÌÁö ÀúÀå
copy($upload_file,$ap2);
chmod($ap2,0777);
$is=getimagesize($ap2);
// À̹ÌÁö ¼öÁ¤
echo "
";
}
else error("ERROR >> À̹ÌÁö´Â JPG ¶Ç´Â GIF Çü½Ä¸¸ Áö¿øÇÕ´Ï´Ù.");
}
else error("ERROR >> À̹ÌÁö¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
break;
case viewimgsrc:
// À̹ÌÁö ´Ù¿î·Îµå º¸±â
$src2=@explode("/",$src);
$src2=$src2[count($src2)-1];
if(eregi("(MSIE 5.5|MSIE 6.0)", $HTTP_USER_AGENT)) // ºê¶ó¿ìÁ® ±¸ºÐ
{
Header("Content-type: application/octet-stream");
Header("Content-Disposition: attachment; filename=$src2");
Header("Content-Transfer-Encoding: binary");
Header("Pragma: no-cache");
Header("Expires: 0");
} else {
Header("Content-type: file/unknown");
Header("Content-Disposition: attachment; filename=$src2");
Header("Content-Description: PHP3 Generated Data");
Header("Pragma: no-cache");
Header("Expires: 0");
}
$fp=fopen($src,"r");
if(!fpassthru($fp)) // ¼¹öºÎÇϸ¦ ÁÙÀÌ·Á¸é print ³ª echo ¶Ç´Â while ¹®À» ÀÌ¿ëÇÑ ±âŸ º¸´Ü À̹æ¹ýÀÌ...
fclose($fp);
break;
case img_thumnail:
// À̹ÌÁö ½æ³×ÀÏ »ý¼º
$pass=$upload_pass;
$code=time();
$file_ext=strtolower(substr(strrchr($src,"."),1));
// À̹ÌÁö À̸§ ÁöÁ¤
$ap="${code}.${file_ext}";
$ap2="$pass/$ap";
// ¿øº» ·Îµå
$fp=@fopen($src,"rb");
$img=fread($fp,10000000);
fclose($fp);
// À̹ÌÁö ÀúÀå
$fp2=@fopen($ap2,"wb");
fwrite($fp2,$img);
fclose($fp2);
chmod($ap2,0777);
//¿øº» À̹ÌÁö Á¤º¸
$asrc="$upload_pass_http/$ap"; // ¿øº»
$is=@getimagesize($ap2);
// ½æ³×ÀÏ »ý¼º
$aps="s_${ap}";
$aps2="$pass/$aps";
if($bl=="w") {
$x=$w;
$y=round(($x/$is[0])*$is[1]);
}
else {
$y=$h;
$x=round(($y/$is[1])*$is[0]);
}
if($file_ext=="gif") imagegif(thumbnail($ap2,$x,$y),$aps2);
elseif($file_ext=="jpg") {
$duty_thumb = new DutyThumb();
$duty_thumb->init("${pass}",$ap);
$duty_thumb->Create($pass,$aps,$x,$y);
$duty_thumb->Destroy();
}
// ½æ³×ÀÏ À̹ÌÁö Á¤º¸
$dsrc="$upload_pass_http/$aps"; // ½æ³×ÀÏ
$dis=@getimagesize($aps2);
// À̹ÌÁö ¼öÁ¤
echo "
";
// ¸µÅ© »ý¼º
if($cl==1) {
$x=$is[0];
$y=$is[1];
echo "
";
}
break;
default:
error('ÇØ´çÇÏ´Â ÀÛ¾÷ÀÌ ¾ø½À´Ï´Ù');
break;
}
?>