source: branches/feature-module-zeus/html/resize_image.php @ 15056

Revision 15056, 1.2 KB checked in by adati, 17 years ago (diff)

relブランチのマージ(r12156-r15055)

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.