implement avatar image cache

This commit is contained in:
ghost 2021-12-31 06:08:27 +02:00
parent c40e0176f3
commit a06afb19cd
2 changed files with 14 additions and 2 deletions

View File

@ -2,8 +2,20 @@
if (isset($_GET['hash'])) {
$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");
echo $icon->generateImageResource(md5($_GET['hash']), 42, 42, false);
echo $image;
}

0
src/cache/image/index.html vendored Normal file
View File