From 9edd6d32af8691e11ba3863804a50bae070f6891 Mon Sep 17 00:00:00 2001 From: zero Date: Fri, 28 Sep 2007 06:05:38 +0000 Subject: [PATCH] =?UTF-8?q?=EC=9B=90=EB=B3=B8=20=EC=9D=B4=EB=AF=B8?= =?UTF-8?q?=EC=A7=80=EA=B0=80=20=EC=8D=B8=EB=84=A4=EC=9D=BC=20=EB=8C=80?= =?UTF-8?q?=EC=83=81=20=EC=9D=B4=EB=AF=B8=EC=A7=80=EB=B3=B4=EB=8B=A4=20?= =?UTF-8?q?=EC=9E=91=EC=9D=84=20=EA=B2=BD=EC=9A=B0=EC=97=90=EB=8F=84=20?= =?UTF-8?q?=EC=A0=9C=EB=8C=80=EB=A1=9C=20=EC=8D=B8=EB=84=A4=EC=9D=BC?= =?UTF-8?q?=EC=9D=84=20=EB=A7=8C=EB=93=A4=EB=8F=84=EB=A1=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://xe-core.googlecode.com/svn/sandbox@2648 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- classes/file/FileHandler.class.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/classes/file/FileHandler.class.php b/classes/file/FileHandler.class.php index fb63f77f7..5ff0aa954 100644 --- a/classes/file/FileHandler.class.php +++ b/classes/file/FileHandler.class.php @@ -214,6 +214,7 @@ if($resize_height>0 && $height >= $resize_height) $height_per = $resize_height / $height; if($width_per < $height_per) $per = $height_per; else $per = $width_per; + if(!$per) $per = 1; // 원본 이미지의 타입으로 임시 이미지 생성 switch($type) { @@ -246,14 +247,12 @@ $new_width = (int)($width * $per); $new_height = (int)($height * $per); - $x = ($resize_width/2 - $new_width/2); - $y = ($resize_height/2 - $new_height/2); + $x = (int)($resize_width/2 - $new_width/2); + $y = (int)($resize_height/2 - $new_height/2); if($source) { - if($new_width != $width || $new_height != $height) { - if(function_exists('imagecopyresampled')) @imagecopyresampled($thumb, $source, $x, $y, 0, 0, $new_width, $new_height, $width, $height); - else @imagecopyresized($thumb, $source, $x, $y, 0, 0, $new_width, $new_height, $width, $height); - } else $thumb = $source; + if(function_exists('imagecopyresampled')) @imagecopyresampled($thumb, $source, $x, $y, 0, 0, $new_width, $new_height, $width, $height); + else @imagecopyresized($thumb, $source, $x, $y, 0, 0, $new_width, $new_height, $width, $height); } // 파일을 쓰고 끝냄