feat: 新增App图标搜索器增强版功能
引入完整的App图标搜索器增强版,包括前端页面、后端缓存系统、样式和脚本。主要功能包括实时搜索、多尺寸图标下载、图片预览、响应式设计和智能缓存机制。后端通过ImageCache类实现图片缓存,前端通过JavaScript优化搜索交互和图片加载体验。新增README.md提供详细的部署和开发指南。
This commit is contained in:
37
cache/image.php
vendored
Normal file
37
cache/image.php
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
require_once 'ImageCache.php';
|
||||
|
||||
$url = isset($_GET['url']) ? $_GET['url'] : '';
|
||||
if (empty($url)) {
|
||||
header("HTTP/1.0 404 Not Found");
|
||||
exit;
|
||||
}
|
||||
|
||||
$imageCache = new ImageCache();
|
||||
$image = $imageCache->getCachedImage($url);
|
||||
|
||||
if ($image === false) {
|
||||
header("HTTP/1.0 404 Not Found");
|
||||
exit;
|
||||
}
|
||||
|
||||
$extension = pathinfo(parse_url($url, PHP_URL_PATH), PATHINFO_EXTENSION);
|
||||
switch(strtolower($extension)) {
|
||||
case 'jpg':
|
||||
case 'jpeg':
|
||||
header('Content-Type: image/jpeg');
|
||||
break;
|
||||
case 'png':
|
||||
header('Content-Type: image/png');
|
||||
break;
|
||||
case 'gif':
|
||||
header('Content-Type: image/gif');
|
||||
break;
|
||||
default:
|
||||
header('Content-Type: image/jpeg');
|
||||
}
|
||||
|
||||
header('Cache-Control: public, max-age=31536000');
|
||||
header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 31536000));
|
||||
|
||||
echo $image;
|
||||
Reference in New Issue
Block a user