<?php
// ̹ Ͽ ̸ ϴ Լ
function resize_image($file, $wantwidth, $newfile) {
list($width, $height) = getimagesize($file);
// ʰ
$ratio = $width / $height;
$newheight = $wantwidth/$ratio;
$newwidth = $wantwidth;
$exploding = explode(".",$file);
$ext = end($exploding);
// Ȯڿ ̹ ̳ʸ
switch($ext){
case "png":
$src = imagecreatefrompng($file);
break;
case "jpeg":
case "jpg":
default:
$src = imagecreatefromjpeg($file);
break;
case "gif":
$src = imagecreatefromgif($file);
break;
}
// ϴ ũ ̹ .
$dest = imagecreatetruecolor($newwidth, $newheight);
// ũ ٲ㼭 ̹ .
imagecopyresampled($dest, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
// ̹ ٽ . png 0 ְ ǰ, jpg 100 ְ ǰ. ǰ 75 .
switch($ext){
case "png":
imagepng($dest, $newfile);
break;
case "jpeg":
case "jpg":
default:
imagejpeg($dest, $newfile);
break;
case "gif":
imagegif($dest, $newfile);
break;
}
imagedestroy($dest);
}
// ̹
$imagepath = "sbimage/";
// CKEditor id, ε Լ ȣ, ڵ.
// 4.13 ʰ json Ѵ.
//$CKEditor = $_GET['CKEditor'] ;
//$funcNum = $_GET['CKEditorFuncNum'] ;
//$langCode = $_GET['langCode'] ;
// ̹ ε File Ʈ ID upload Ǿ ִ.
if (isset($_FILES['upload'])) {
$name = $_FILES['upload']['name'];
$oripath = $imagepath.$name;
move_uploaded_file($_FILES["upload"]["tmp_name"], $oripath);
// ̸ ֱ. ̸ ߺ üũ
$newname = $imagepath."resize_" . $name;
resize_image($oripath, 720, $newname);
// unlink($oripath);
// ε ̹ URL ϴ.
$url = $newname ;
} else {
// $message = 'ε ϴ.';
}
// ̹ ε iframe ؼ óǹǷ parent ϱ ؼ ڹٽũƮ մϴ.
//echo "<script type='text/javascript'>; window.parent.CKEDITOR.tools.callFunction($funcNum, '$url', '$message')</script>";
// CKEditor json · ؾ Ѵٰ .
$json = '{"filename" : "'. $name .'", "uploaded" : 1, "url":"'. $url .'"}';
echo ($json);
?>
õ SoEn 이천출장업소 완주오피
장암역출장샵
군위읍성인맛사지
울주오피 | 종촌동출장타이미사지 | 기장오피
늑대 수간 만화
탄방동출장대행
상인역타이마사지
유부녀사냥 4화
어정역번개만남
국내bj
클로저스 동 인
봉고렌트
대구콜걸샵
던파로간다
다시찾을께요 인천출장마사지
부수입만들기 | 직딩부업 | 가상화폐의 미래
세부여행
옷스타그램일상
소액투자앱
소통해요
시카고피자
여행네일
분식스타그램
데일리룩
가상화폐 전망 2019부천역맛집천안맛집
광주출장안마
만남의광장 휴게소
유비벨록스
후타나리망가
외국인친구만나기
|
|