source: branches/feature-module-paygent/data/class/GC_Thumb.php @ 17

Revision 17, 1.8 KB checked in by uehara, 14 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
8require_once("../lib/thumb.php");
9
10/*----------------------------------------------------------------------
11 * [̾¾Î] GC_Thumb
12 * [³µÍ×] ¥¢¥Ã¥×¥í¡¼¥É¥Õ¥¡¥¤¥ë²Ã¹©¥¯¥é¥¹(thumb.php¤È¥»¥Ã¥È¤Ç»ÈÍѤ¹¤ë)
13 * [°ú¿ô] -
14 * [ÌáÃÍ] -
15 * [°Í¸] thumb.php
16 * [Ãí¼á] -
17 *----------------------------------------------------------------------*/
18
19Class GC_Thumb {
20
21    var $tempPath;
22
23    function GC_Thumb($tempFilePath = "") {
24        $this->tempPath  = $_SERVER['DOCUMENT_ROOT'] . $tempFilePath;
25    }
26
27    //--- °ì»þ¥Õ¥¡¥¤¥ëÀ¸À®(¥µ¥à¥Í¥¤¥ë²èÁüÀ¸À®ÍÑ)
28    function makeImageTempFile($fileName, $phpFileName, $max_width,$max_height) {
29        // °ì°Õ¤ÊID¤ò¼èÆÀ¤¹¤ë¡£
30        $mainname = uniqid("").".";
31        // ³ÈÄ¥»Ò°Ê³°¤òÃÖ¤­´¹¤¨¤ë¡£
32        $newFileName = ereg_replace("^.*\.",$mainname,$fileName);
33        $result  = MakeThumb( $phpFileName, $this->tempPath, $max_width, $max_height, $newFileName );
34        return $newFileName;
35    }
36
37    //--- °ì»þ¥Õ¥¡¥¤¥ëÀ¸À®
38    function makeTempFile($fileName, $phpFileName) {
39        $newFileNname = str_replace("'", "¡Ç", $fileName );
40        $newFileNname = date("siU") . $newFileNname;
41        copy( $phpFileName, $this->tempPath . $newFileNname );
42        return $newFileNname;   
43    }
44
45    //--- ¥Õ¥¡¥¤¥ë¤ò»ØÄêÊݸDIR¤Ø°ÜÆ°
46    function fileMove($fileName, $dirName) {
47        if(copy( $this->tempPath . $fileName , $_SERVER['DOCUMENT_ROOT'] . $dirName . $fileName)) {
48            unlink( $this->tempPath . $fileName );
49        }
50    }
51
52    //---- °ì»þDIR¤Î¥Õ¥¡¥¤¥ë¤ò°ì³çºï½ü 
53    function execDeleteTempFile() {
54        chdir( $this->tempPath );
55        $delFile = glob( "*.*" );
56        if( is_array($delFile) ) foreach( $delFile as $val ) @unlink( $val );
57    }
58
59    //---- »ØÄê¥Õ¥¡¥¤¥ë¤òºï½ü   
60    function fileDelete($fileName, $dirName) {
61        unlink( $_SERVER['DOCUMENT_ROOT'] . $dirName . $fileName );
62    }
63}
64?>
Note: See TracBrowser for help on using the repository browser.