Repositories | Polyback | Log in to see private repositories
753 bytes | parent directory
<?php require $_SERVER['DOCUMENT_ROOT']."/api/private/core.php";
use pizzaboxer\ProjectPolygon\Database;
use pizzaboxer\ProjectPolygon\Thumbnails;
header("Pragma: no-cache");
header("Cache-Control: no-cache");
$id = $_GET['UserID'] ?? false;
$render = Database::singleton()->run(
"SELECT renderStatus, timestampRequested FROM renderqueue WHERE renderType = 'Avatar' AND assetID = :id ORDER BY timestampRequested DESC LIMIT 1",
[":id" => $id]
)->fetch(\PDO::FETCH_OBJ);
// still being made (0 waiting, 1 rendering) - but not forever: a failed or lost render gives the last picture
if ($render && in_array((int) $render->renderStatus, [0, 1]) && $render->timestampRequested > time() - 120) die("PENDING");
echo Thumbnails::GetAvatar($id, 420, 420);