mirror of
https://github.com/twisterarmy/cloud-server.git
synced 2025-09-10 12:51:56 +00:00
implement avatar image cache
This commit is contained in:
parent
c40e0176f3
commit
a06afb19cd
@ -2,8 +2,20 @@
|
|||||||
|
|
||||||
if (isset($_GET['hash'])) {
|
if (isset($_GET['hash'])) {
|
||||||
|
|
||||||
$icon = new Icon();
|
$filename = md5($_GET['hash']);
|
||||||
|
$filepath = PROJECT_DIR . '/cache/image/' . $filename . '.jpeg';
|
||||||
|
|
||||||
|
if (!file_exists($filepath)) {
|
||||||
|
|
||||||
|
$icon = new Icon();
|
||||||
|
$image = $icon->generateImageResource($filename, 42, 42, false);
|
||||||
|
|
||||||
|
file_put_contents($filepath, $image);
|
||||||
|
}
|
||||||
|
|
||||||
|
$image = file_get_contents($filepath);
|
||||||
|
|
||||||
header("Content-Type: image/jpeg");
|
header("Content-Type: image/jpeg");
|
||||||
echo $icon->generateImageResource(md5($_GET['hash']), 42, 42, false);
|
|
||||||
|
echo $image;
|
||||||
}
|
}
|
||||||
|
0
src/cache/image/index.html
vendored
Normal file
0
src/cache/image/index.html
vendored
Normal file
Loading…
x
Reference in New Issue
Block a user