first commit
This commit is contained in:
32
index.php
Normal file
32
index.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
require_once 'ImageProxy.php';
|
||||
|
||||
// 设置错误报告
|
||||
error_reporting(E_ERROR | E_PARSE);
|
||||
|
||||
// 设置内存限制
|
||||
ini_set('memory_limit', '256M');
|
||||
|
||||
// 设置执行时间限制
|
||||
set_time_limit(30);
|
||||
|
||||
// 获取URL参数
|
||||
$url = $_GET['url'] ?? '';
|
||||
|
||||
// 创建ImageProxy实例
|
||||
$proxy = new ImageProxy([
|
||||
'cache_dir' => 'cache',
|
||||
'timeout' => 30,
|
||||
'connect_timeout' => 15,
|
||||
'max_redirects' => 5
|
||||
]);
|
||||
|
||||
// 处理请求
|
||||
if (!empty($url)) {
|
||||
$proxy->processRequest($url);
|
||||
} else {
|
||||
// 输出错误信息
|
||||
header("HTTP/1.1 400 Bad Request");
|
||||
header("Content-type: image/jpeg");
|
||||
echo base64_decode('R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7');
|
||||
}
|
||||
Reference in New Issue
Block a user