-
Notifications
You must be signed in to change notification settings - Fork 2
/
icon_trc10.php
36 lines (29 loc) · 968 Bytes
/
icon_trc10.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
header('Content-Type: image/png');
//ini_set('display_errors', '1');
$selectedToken = $_GET['token'];
$autoResolve = $_GET['autoResolve'];
$filename = 'icons/tron/trc10/' . $selectedToken . '.png';
//
if (file_exists($filename)) {
$image = file_get_contents('icons/tron/trc10/' . $selectedToken . '.png');
} else {
$image = file_get_contents('icons/tron/trc10/' . strtolower($selectedToken) . '.png');
if ($image) {
} else {
$checkTronscan = json_decode(file_get_contents('https://apilist.tronscan.org/api/token?id=' . $selectedToken . '&showAll=1'));
$image = file_get_contents($checkTronscan->data['0']->imgUrl);
}
if ($image) {
$file = 'icons/tron/trc10/' . $selectedToken . '.png';
file_put_contents($file, $image, FILE_APPEND | LOCK_EX);
} else {
if ($autoResolve === 'false') {
http_response_code(404);
die();
} else {
$image = file_get_contents('icons/unknown.png');
}
}
}
echo $image;