source: branches/rel/data/class/SC_Image.php @ 12157

Revision 12157, 1.5 KB checked in by uehara, 17 years ago (diff)
Line 
1<?php
2/*
3 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
4 *
5 * http://www.lockon.co.jp/
6 */
7
8//---- ¥¢¥Ã¥×¥í¡¼¥É¥Õ¥¡¥¤¥ë²Ã¹©¥¯¥é¥¹(thumb.php¤È¥»¥Ã¥È¤Ç»ÈÍѤ¹¤ë)
9class SC_Image {
10   
11    var $tmp_dir;
12       
13    function SC_Image($tmp_dir) {
14        // ¥Ø¥Ã¥À¥Õ¥¡¥¤¥ëÆɹþ
15        $include_dir = realpath(dirname( __FILE__));
16        require_once($include_dir . "/../lib/thumb.php");
17        if(!ereg("/$", $tmp_dir)) {
18            $this->tmp_dir = $tmp_dir . "/";
19        } else {
20            $this->tmp_dir = $tmp_dir;
21        }
22    }
23   
24    //--- °ì»þ¥Õ¥¡¥¤¥ëÀ¸À®(¥µ¥à¥Í¥¤¥ë²èÁüÀ¸À®ÍÑ)
25    function makeTempImage($keyname, $max_width, $max_height) {
26        // °ì°Õ¤ÊID¤ò¼èÆÀ¤¹¤ë¡£
27        $mainname = uniqid("").".";
28        // ³ÈÄ¥»Ò°Ê³°¤òÃÖ¤­´¹¤¨¤ë¡£
29        $newFileName = ereg_replace("^.*\.",$mainname, $_FILES[$keyname]['name']);
30        $result  = MakeThumb($_FILES[$keyname]['tmp_name'], $this->tmp_dir , $max_width, $max_height, $newFileName);
31        gfDebugLog($result);
32        return $newFileName;
33    }
34
35    //--- ¥Õ¥¡¥¤¥ë¤ò»ØÄêÊݸDIR¤Ø°ÜÆ°
36    function moveTempImage($filename, $save_dir) {
37        // ¥³¥Ô¡¼¸µ¥Õ¥¡¥¤¥ë¡¢¥³¥Ô¡¼Àè¥Ç¥£¥ì¥¯¥È¥ê¤¬Â¸ºß¤¹¤ë¾ì¹ç¤Ë¤Î¤ß¼Â¹Ô¤¹¤ë
38        if(file_exists($this->tmp_dir.$filename) && file_exists($save_dir)) {
39            if(copy($this->tmp_dir . $filename , $save_dir."/".$filename)) {
40                unlink( $this->tmp_dir . $filename );
41            }
42        } else {
43            gfDebugLog($this->tmp_dir.$filename."¤Î°ÜÆ°¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£");
44        }
45    }
46
47    //---- »ØÄê¥Õ¥¡¥¤¥ë¤òºï½ü   
48    function deleteImage($filename, $dir) {
49        if(file_exists($dir."/".$filename)) {
50            unlink($dir."/".$filename);
51        }
52    }
53
54}
55?>
Note: See TracBrowser for help on using the repository browser.