GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — p2-php/ic2_getinfo.php at master · thermon/p2-php

Expand file tree

/

ic2_getinfo.php

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
101 lines (84 loc) · 2.43 KB
/

ic2_getinfo.php

Copy path

File metadata and controls

101 lines (84 loc) · 2.43 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
/**
* ImageCache2 - 画像のID or URLから情報を取得する
*/
// {{{ p2基本設定読み込み&認証
require_once './conf/conf.inc.php';
$_login->authorize();
if (!$_conf['expack.ic2.enabled']) {
p2die('ImageCache2は無効です。', 'conf/conf_admin_ex.inc.php の設定を変えてください。');
}
// }}}
// {{{ HTTPヘッダ
P2Util::header_nocache();
header('Content-Type: application/json; charset=UTF-8');
// }}}
// {{{ 初期化
// パラメータを検証
if (!isset($_GET['id']) && !isset($_GET['url']) && !isset($_GET['md5'])) {
echo 'null';
exit;
}
// ライブラリ読み込み
require_once 'PEAR.php';
require_once 'DB.php';
require_once 'DB/DataObject.php';
require_once P2EX_LIB_DIR . '/ic2/loadconfig.inc.php';
require_once P2EX_LIB_DIR . '/ic2/DataObject/Common.php';
require_once P2EX_LIB_DIR . '/ic2/DataObject/Images.php';
require_once P2EX_LIB_DIR . '/ic2/Thumbnailer.php';
// }}}
// {{{ execute
$icdb = new IC2_DataObject_Images;
if (isset($_GET['id'])) {
$icdb->whereAdd(sprintf('id=%d', (int)$_GET['id']));
} elseif (isset($_GET['url'])) {
$icdb->whereAddQuoted('uri', '=', (string)$_GET['url']);
} else {
$icdb->whereAddQuoted('md5', '=', (string)$_GET['md5']);
}
if (!$icdb->find(1)) {
echo 'null';
exit;
}
$thumb_type = isset($_GET['t']) ? $_GET['t'] : IC2_Thumbnailer::SIZE_DEFAULT;
switch ($thumb_type) {
case IC2_Thumbnailer::SIZE_PC:
case IC2_Thumbnailer::SIZE_MOBILE:
case IC2_Thumbnailer::SIZE_INTERMD:
$thumbnailer = new IC2_Thumbnailer($thumb_type);
break;
default:
$thumbnailer = new IC2_Thumbnailer();
}
$src = $thumbnailer->srcPath($icdb->size, $icdb->md5, $icdb->mime);
$thumb = $thumbnailer->thumbPath($icdb->size, $icdb->md5, $icdb->mime);
echo json_encode(array(
'id' => (int)$icdb->id,
'uri' => $icdb->uri,
'host' => $icdb->host,
'name' => $icdb->name,
'size' => (int)$icdb->size,
'md5' => $icdb->md5,
'width' => (int)$icdb->width,
'height' => (int)$icdb->height,
'mime' => $icdb->mime,
'rank' => (int)$icdb->rank,
'time' => (int)$icdb->time,
'memo' => $icdb->memo,
'url' => $icdb->uri,
'src' => ($src && file_exists($src)) ? $src : null,
'thumb' => ($thumb && file_exists($thumb)) ? $thumb : null,
));
exit;
// }}}
/*
* Local Variables:
* mode: php
* coding: cp932
* tab-width: 4
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*/
// vim: set syn=php fenc=cp932 ai et ts=4 sw=4 sts=4 fdm=marker:
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.