source: temp/trunk/data/class/SC_Image.php @ 1328

Revision 1328, 1.4 KB checked in by naka, 20 years ago (diff)

* empty log message *

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