blob: 408b8c817677ff69dae23ac1560ac8fe629fc507 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn;
if (!$isLoggedIn) header("Location: /login") and die();
global $_PROFILE;
header("Content-Type: application/json");
$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($_PROFILE['name'] === "Cloudburst System" ? "ynmuc" : "gdapd") . "-fronters.json"), true);
$member = $fronters["members"][0];
if (isset($member["avatar_url"])) {
$tempfile = "/tmp/avatar-" . rand(0, 999999) . ".jpg";
file_put_contents($tempfile . "-original", file_get_contents($member["avatar_url"]));
exec("convert -resize 256x256 -quality 50 \"" . $tempfile . "-original" . "\" \"" . $tempfile . "\"", $output);
echo("data:image/jpg;base64," . base64_encode(file_get_contents($tempfile)));
//echo(implode("\n", $output));
unlink($tempfile . "-original");
unlink($tempfile);
} else {
die();
}
|