source: branches/feature-module-update/html/resize_image.php @ 15080

Revision 15080, 1.2 KB checked in by nanasess, 17 years ago (diff)

svn properties 設定

  • svn:mime-type - application/x-httpd-php; charset=UTF-8
  • svn:keywords - Id
  • Property svn:keywords set to Id
  • Property svn:mime-type set to application/x-httpd-php; charset=UTF-8
Line 
1<?php
2
3$include_dir = realpath(dirname( __FILE__));
4require_once($include_dir . "/define.php");
5
6require_once($include_dir . HTML2DATA_DIR. "lib/gdthumb.php");
7require_once($include_dir . HTML2DATA_DIR. "lib/glib.php");
8require_once($include_dir . HTML2DATA_DIR. "conf/conf.php");
9
10$objThumb = new gdthumb();
11
12$file = NO_IMAGE_DIR;
13
14// NO_IMAGE_DIR以外のファイル名が渡された場合、ファイル名のチェックを行う
15if ( isset($_GET['image']) && $_GET['image'] !== NO_IMAGE_DIR) {
16   
17    // ファイル名が正しい場合だけ、$fileを設定
18    if ( lfCheckFileName() === true ) {
19        $file = IMAGE_SAVE_DIR . $_GET['image'];
20    } else {
21        gfPrintLog('invalid access :resize_image.php $_GET["image"]=' . $_GET['image']);
22    }
23}
24
25if(file_exists($file)){
26    $objThumb->Main($file, $_GET["width"], $_GET["height"], "", true);
27}else{
28    $objThumb->Main(NO_IMAGE_DIR, $_GET["width"], $_GET["height"], "", true);
29}
30
31// ファイル名の形式をチェック
32function lfCheckFileName() {
33    //$pattern = '|^[0-9]+_[0-9a-z]+\.[a-z]{3}$|';
34    $pattern = '|\./|';
35    $file    = trim($_GET["image"]);
36    if ( preg_match_all($pattern, $file, $matches) ) {
37        return false;
38    } else {
39        return true;
40    }
41}
42
43?>
Note: See TracBrowser for help on using the repository browser.