1 | <?php |
---|
2 | /** |
---|
3 | * @copyright 2005-2007 OpenPNE Project |
---|
4 | * @license http://www.php.net/license/3_01.txt PHP License 3.01 |
---|
5 | */ |
---|
6 | |
---|
7 | require_once './config.inc.php'; |
---|
8 | |
---|
9 | // include_path の設定 |
---|
10 | include_once OPENPNE_LIB_DIR . '/include/PHP/Compat/Constant/PATH_SEPARATOR.php'; |
---|
11 | $include_paths = array( |
---|
12 | OPENPNE_LIB_DIR . '/include', |
---|
13 | OPENPNE_WEBAPP_DIR . '/lib', |
---|
14 | ini_get('include_path') |
---|
15 | ); |
---|
16 | ini_set('include_path', implode(PATH_SEPARATOR, $include_paths)); |
---|
17 | require_once OPENPNE_WEBAPP_DIR . '/lib/OpenPNE/DB.php'; |
---|
18 | require_once OPENPNE_WEBAPP_DIR . '/lib/OpenPNE/DB/Writer.php'; |
---|
19 | require_once OPENPNE_WEBAPP_DIR . '/lib/db/common.php'; |
---|
20 | require_once OPENPNE_WEBAPP_DIR . '/lib/db/etc.php'; |
---|
21 | |
---|
22 | $_GET['filename'] = db_get_c_skin_filename4skinname($_GET['filename']); |
---|
23 | |
---|
24 | // エラー出力を抑制 |
---|
25 | ini_set('display_errors', false); |
---|
26 | ob_start(); |
---|
27 | |
---|
28 | // include_path の設定 |
---|
29 | include_once OPENPNE_LIB_DIR . '/include/PHP/Compat/Constant/PATH_SEPARATOR.php'; |
---|
30 | $include_paths = array( |
---|
31 | OPENPNE_LIB_DIR . '/include', |
---|
32 | OPENPNE_WEBAPP_DIR . '/lib', |
---|
33 | ini_get('include_path') |
---|
34 | ); |
---|
35 | ini_set('include_path', implode(PATH_SEPARATOR, $include_paths)); |
---|
36 | |
---|
37 | // 各種設定 |
---|
38 | defined('OPENPNE_IMG_JPEG_QUALITY') or define('OPENPNE_IMG_JPEG_QUALITY', 75); |
---|
39 | if (!empty($GLOBALS['_OPENPNE_DSN_LIST']['image']['dsn'])) { |
---|
40 | $dsn = $GLOBALS['_OPENPNE_DSN_LIST']['image']['dsn']; |
---|
41 | } else { |
---|
42 | $dsn = $GLOBALS['_OPENPNE_DSN_LIST']['main']['dsn']; |
---|
43 | } |
---|
44 | |
---|
45 | |
---|
46 | require_once 'OpenPNE/Img.php'; |
---|
47 | $options = array( |
---|
48 | 'dsn' => $dsn, |
---|
49 | 'cache_dir' => OPENPNE_IMG_CACHE_DIR, |
---|
50 | 'jpeg_quality' => OPENPNE_IMG_JPEG_QUALITY, |
---|
51 | ); |
---|
52 | |
---|
53 | if (defined('USE_IMAGEMAGICK')) { |
---|
54 | switch (USE_IMAGEMAGICK) { |
---|
55 | case 0: |
---|
56 | $use_IM = false; |
---|
57 | break; |
---|
58 | case 1: |
---|
59 | $pieces = explode('.', $_GET['filename']); |
---|
60 | $source_format = OpenPNE_Img::check_format(array_pop($pieces)); |
---|
61 | $use_IM = ($source_format == 'gif'); |
---|
62 | break; |
---|
63 | case 2: |
---|
64 | $use_IM = true; |
---|
65 | break; |
---|
66 | default: |
---|
67 | exit; |
---|
68 | } |
---|
69 | } else { |
---|
70 | $use_IM = false; |
---|
71 | } |
---|
72 | |
---|
73 | if ($use_IM) { |
---|
74 | require_once 'OpenPNE/Img/ImageMagick.php'; |
---|
75 | $img =& new OpenPNE_Img_ImageMagick($options); |
---|
76 | } else { |
---|
77 | $img =& new OpenPNE_Img($options); |
---|
78 | } |
---|
79 | $img->set_requests($_GET); |
---|
80 | |
---|
81 | $img->generate_img() or exit(1); |
---|
82 | while (@ob_end_clean()); |
---|
83 | |
---|
84 | $img->output_img() or exit(2); |
---|
85 | |
---|
86 | ?> |
---|