From 63b38113bcf69839a4a5e56a89d181c6a76bb3db Mon Sep 17 00:00:00 2001 From: chicpro Date: Fri, 14 Mar 2014 15:10:17 +0900 Subject: [PATCH] =?UTF-8?q?=EC=82=AC=EC=9A=A9=ED=95=98=EC=A7=80=20?= =?UTF-8?q?=EC=95=8A=EB=8A=94=20lib=20=ED=8C=8C=EC=9D=BC=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/thumb.lib.php | 128 ------------------------------------ mobile/shop/itemqalist.php | 1 - mobile/shop/itemuselist.php | 1 - shop/itemqalist.php | 2 - shop/itemuselist.php | 2 - 5 files changed, 134 deletions(-) delete mode 100644 lib/thumb.lib.php diff --git a/lib/thumb.lib.php b/lib/thumb.lib.php deleted file mode 100644 index 819fb05de..000000000 --- a/lib/thumb.lib.php +++ /dev/null @@ -1,128 +0,0 @@ -run(이미지 경로가 포함된 컨텐츠); - -*******************************************************************************/ -class g4_thumb { - var $path; - var $width; - var $red = 0xff; - var $green = 0xff; - var $blue = 0xff; - var $quality = 100; - var $permission = G5_FILE_PERMISSION; - - function g4_thumb($path, $width) { - $this->set_path($path); - $this->set_width($width); - } - - // 경로 - function set_path($path) { - $this->path = $path; - @mkdir($path, G5_DIR_PERMISSION); - @chmod($path, G5_DIR_PERMISSION); - } - - function set_width($width) { - $this->width = $width; - } - - function get_width() { - return $this->width; - } - - function set_bgcolor($red, $green, $blue) { - $this->red = $red; - $this->green = $green; - $this->blue = $blue; - } - - function set_quality($quality) { - $this->quality = $quality; - } - - function set_permission($permission) { - $this->permission = $permission; - } - - function create($srcimg, $thumbfile) { - $width = $this->get_width(); - $source = null; - $size = @getimagesize($srcimg); - if ($size[2] == 1) - $source = @imagecreatefromgif($srcimg); - else if ($size[2] == 2) - $source = @imagecreatefromjpeg($srcimg); - else if ($size[2] == 3) - $source = @imagecreatefrompng($srcimg); - - if ($source == null) - return ''; - - // 이미지의 폭이 설정폭 보다 작다면 - if ($size[0] < $width) { - $width = $size[0]; - $height = $size[1]; - } else { - $rate = $width / $size[0]; - $height = (int)($size[1] * $rate); - } - - $target = @imagecreatetruecolor($width, $height); - $bgcolor = @imagecolorallocate($target, $this->red, $this->green, $this->blue); // 썸네일 배경 - imagefilledrectangle($target, 0, 0, $width, $height, $bgcolor); - imagecopyresampled($source, $source, 0, 0, 0, 0, $width, $height, $size[0], $size[1]); - imagecopy($target, $source, 0, 0, 0, 0, $size[0], $size[1]); - imagejpeg($target, $thumbfile, $this->quality); - chmod($thumbfile, $this->permission); // 추후 삭제를 위하여 파일모드 변경 - return $thumbfile; - } - - function thumbnail($matches) - { - foreach ($matches as $img) { - preg_match("/src=[\"\']?([^\"\'\s>]+)/i", $img, $m); - $src = trim($m[1]); - - $result = true; - if (preg_match("/\.(jpe?g|png|gif)$/i", $src)) { - // 유일한 파일명을 만든다. - $filename = md5($src).'_'.$this->width; - $thumb = $this->path.'/'.$filename; - - if (!file_exists($thumb)) { - $result = $this->create($src, $thumb); - } - } - else { - $thumb = $src; - } - - if ($result) { - $size = @getimagesize($src); - if ($size[0] < $this->width) { - return ""; - } else { - return ""; - } - } - } - } - - function run($content) - { - //return preg_replace_callback('#]+>#iS', create_function('$matches', 'return g4_thumb::thumbnail($matches);'), $content); - //return preg_replace_callback('#]+>#iS', array('g4_thumb', 'thumbnail'), $content); - //return preg_replace_callback('#]+>#iS', 'g4_thumb::thumbnail', $content); - return preg_replace_callback('#]+>#iS', array($this, 'thumbnail'), $content); - } -} -?> \ No newline at end of file diff --git a/mobile/shop/itemqalist.php b/mobile/shop/itemqalist.php index 00f01f867..6f7e59ed9 100644 --- a/mobile/shop/itemqalist.php +++ b/mobile/shop/itemqalist.php @@ -1,6 +1,5 @@