,despite that I changed my avatar,it won't load my avatar from USGNPlease answer this question
General
USGN Avatar won't load
USGN Avatar won't load
1

,despite that I changed my avatar,it won't load my avatar from USGN

gloryS: That's another issue. CS2D caches all avatars and never loads them twice. So if someone changes an avatar you already loaded, it won't be changed for you.sys/cache/avatars/steam
saint-: The spray logo is transferred directly via the game server using UDP. So this certainly isn't related to the HTTPS problems.
DC: ,
mrc: It is very possible that the server move broke it. The problem is that the avatar download needs to work via HTTP not via HTTPS because CS2D doesn't support HTTPS at all. The web server is still configured to allow HTTP if it's the CS2D client but maybe it broke something with that config.
Gennadiy: you may have to delete your sys/cache/avatars
mrc: Not sure what happens on your system. like I said would be interesting to see the actual content of the cached files
DC: ,<html> <head><title>404 Not Found</title></head> <body> <center><h1>404 Not Found</h1></center> <hr><center>nginx</center> </body> </html>
Try Steam -> Fail (404) -> Show default USGN icon
Try Steam -> Fail (404) -> Check if USGN cache exists -> If yes, load it; if not, DOWNLOAD from USGN -> If USGN download also fails, then show default icon.
<?php
/**
* Steam Avatar Proxy for CS2D
*
* Usage: http://unrealsoftware.de/steam_avatar.php?hash=AVATAR_HASH
* Example: http://unrealsoftware.de/steam_avatar.php?hash=dca845a92112987f3b20426cb4169b1cec15eb7e
*
* Returns the JPG avatar image (full size) over plain HTTP.
*/
// ============================================================
// CONFIGURATION
// ============================================================
// Maximum execution time (seconds)
$timeout = 10;
// Local cache directory (create with write permissions)
$cache_dir = __DIR__ . '/cache_steam_avatars/';
// Avatar size: 'full' (default), 'medium', or 'small'
$avatar_size = 'full';
// ============================================================
// HASH VALIDATION
// ============================================================
if (!isset($_GET['hash'])) {
http_response_code(400);
die('Missing hash parameter');
}
$hash = $_GET['hash'];
// Remove any non-hexadecimal characters (security)
$hash = preg_replace('/[^a-f0-9]/', '', strtolower($hash));
// Steam hashes are 40-character hex strings (SHA1)
if (strlen($hash) !== 40) {
http_response_code(400);
die('Invalid hash format');
}
// ============================================================
// BUILD STEAM URL (FIXED AND SECURE DOMAIN)
// ============================================================
$avatar_url = "https://avatars.steamstatic.com/" . $hash . '_' . $avatar_size . '.jpg';
// ============================================================
// LOCAL CACHE
// ============================================================
if ($cache_dir) {
if (!is_dir($cache_dir)) {
mkdir($cache_dir, 0755, true);
}
$cache_file = $cache_dir . $hash . '_' . $avatar_size . '.jpg';
// If cached file exists and is younger than 7 days, serve it directly
if (file_exists($cache_file) && (time() - filemtime($cache_file) < 604800)) {
$image_data = file_get_contents($cache_file);
if ($image_data !== false) {
header('Content-Type: image/jpeg');
header('X-Cache: HIT');
http_response_code(200);
echo $image_data;
exit;
}
}
}
// ============================================================
// DOWNLOAD VIA CURL (HTTPS)
// ============================================================
$ch = curl_init($avatar_url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CONNECTTIMEOUT => $timeout,
CURLOPT_TIMEOUT => $timeout,
CURLOPT_USERAGENT => 'CS2D-Steam-Avatar-Proxy/1.0 (+https://unrealsoftware.de)',
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_SSL_VERIFYHOST => 2,
]);
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$content_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
if ($response === false) {
http_response_code(502);
die('Curl error: ' . curl_error($ch));
}
curl_close($ch);
// ============================================================
// VALIDATE STEAM RESPONSE
// ============================================================
if ($http_code !== 200) {
http_response_code($http_code);
die('Steam returned HTTP ' . $http_code);
}
// Ensure Steam returned an actual image, not an error page
if (!str_starts_with($content_type, 'image/')) {
http_response_code(502);
die('Steam returned non-image content: ' . $content_type);
}
// ============================================================
// SAVE TO LOCAL CACHE
// ============================================================
if ($cache_dir && isset($cache_file)) {
file_put_contents($cache_file, $response);
}
// ============================================================
// RETURN IMAGE TO CLIENT (CS2D)
// ============================================================
header('Content-Type: ' . $content_type);
header('X-Cache: MISS');
http_response_code(200);
echo $response;
exit;
1
