Changeset 21764


Ignore:
Timestamp:
2012/04/18 16:29:29 (12 years ago)
Author:
shutta
Message:

#1765 LC_Page_ResizeImage を2.11の構造っぽく改修

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-dev/data/class/pages/LC_Page_ResizeImage.php

    r21515 r21764  
    5252     */ 
    5353    function process() { 
    54         $objThumb = new gdthumb(); 
     54        parent::process(); 
     55        $this->action(); 
     56        $this->sendResponse(); 
     57    } 
     58 
     59    /** 
     60     * Page のAction. 
     61     * 
     62     * @return void 
     63     */ 
     64    function action() { 
     65        $objFormParam = new SC_FormParam_Ex(); 
     66        $this->lfInitParam($objFormParam); 
     67        $objFormParam->setParam($_GET); 
     68        $arrForm  = $objFormParam->getHashArray(); 
    5569 
    5670        $file = NO_IMAGE_REALFILE; 
    5771 
    5872        // NO_IMAGE_REALFILE以外のファイル名が渡された場合、ファイル名のチェックを行う 
    59         if (strlen($_GET['image']) >= 1 && $_GET['image'] !== NO_IMAGE_REALFILE) { 
     73        if (strlen($arrForm['image']) >= 1 
     74            && $arrForm['image'] !== NO_IMAGE_REALFILE) { 
    6075 
    6176            // ファイル名が正しく、ファイルが存在する場合だけ、$fileを設定 
    6277            if (!$this->lfCheckFileName()) { 
    63                 GC_Utils_Ex::gfPrintLog('invalid access :resize_image.php $_GET[\'image\']=' . $_GET['image']); 
    64             } 
    65             else if (file_exists(IMAGE_SAVE_REALDIR . $_GET['image'])) { 
    66                 $file = IMAGE_SAVE_REALDIR . $_GET['image']; 
     78                GC_Utils_Ex::gfPrintLog('invalid access :resize_image.php image=' . $arrForm['image']); 
     79            } elseif (file_exists(IMAGE_SAVE_REALDIR . $arrForm['image'])) { 
     80                $file = IMAGE_SAVE_REALDIR . $arrForm['image']; 
    6781            } 
    6882        } 
    6983 
    70         $objThumb->Main($file, $_GET['width'], $_GET['height'], '', true); 
     84        // リサイズ画像の出力 
     85        $this->lfOutputImage($file, $arrForm['width'], $arrForm['height']); 
    7186    } 
    7287 
     
    7893    function destroy() { 
    7994        parent::destroy(); 
     95    } 
     96 
     97    function lfInitParam(&$objFormParam) { 
     98        $objFormParam->addParam('画像ファイル名', 'image', STEXT_LEN, 'a',  array('MAX_LENGTH_CHECK')); 
     99        $objFormParam->addParam('画像の幅', 'width', STEXT_LEN, 'n',  array('NUM_CHECK')); 
     100        $objFormParam->addParam('画像の高さ', 'width', STEXT_LEN, 'n',  array('NUM_CHECK')); 
    80101    } 
    81102 
     
    95116        } 
    96117    } 
     118 
     119    /** 
     120     * 画像の出力 
     121     * 
     122     * @param string $file 画像ファイル名 
     123     * @param integer $width 画像の幅 
     124     * @param integer $height 画像の高さ 
     125     *  
     126     * @return void 
     127     */ 
     128    function lfOutputImage($file, $width, $height) { 
     129        $objThumb = new gdthumb(); 
     130        $objThumb->Main($file, $width, $height, '', true); 
     131    } 
    97132} 
Note: See TracChangeset for help on using the changeset viewer.