PATH:
home
/
centosnipponia
/
public_html
/
ticketing.nipponia.com
/
osta
/
php
<?php /********************************************************************* osta/php/avatar-initials.php Initials-based avatar generation for osTicket Awesome. Replaces the sprite-based composite avatars with clean, colored circles showing user initials. Uses lasserafn/php-initial-avatar-generator (osta/lib/initial-avatar/) **********************************************************************/ // Color palette — works in both light and dark osTicket themes define('OSTA_AVATAR_COLORS', serialize([ '#4A90D9', '#E74C3C', '#2ECC71', '#F39C12', '#9B59B6', '#1ABC9C', '#E67E22', '#3498DB', '#E91E63', '#00BCD4', '#8E44AD', '#27AE60', ])); /** * Pick a deterministic background color from the uid hash. */ function osta_avatar_color($uid) { $colors = unserialize(OSTA_AVATAR_COLORS); return $colors[hexdec(substr($uid, 0, 2)) % count($colors)]; } /** * Render an initials avatar PNG and exit. * Called from avatar.php when mode=initials. */ function osta_render_initials_avatar($params) { require_once ROOT_DIR . 'osta/lib/initial-avatar/vendor/autoload.php'; $uid = $params['uid']; $size = isset($params['size']) ? (int) $params['size'] : 80; if ($size <= 0) $size = 80; $name = isset($params['name']) ? trim($params['name']) : ''; // Fall back to uid hex characters if no name provided if (!$name) $name = strtoupper(substr($uid, 0, 2)); $avatar = new \LasseRafn\InitialAvatarGenerator\InitialAvatar(); $image = $avatar ->name($name) ->size($size) ->background(osta_avatar_color($uid)) ->color('#FFFFFF') ->generate(); Http::response(200, false, 'image/png', false); Http::cacheable($uid . $name, false, 86400); echo $image->stream('png', 90); } /** * Build URL args for an initials avatar request. * Used by LocalAvatar::getUrl() and Gravatar::getImageTag(). */ function osta_initials_avatar_args($uid, $size, $user = null) { $args = array('uid' => $uid, 'mode' => 'initials'); if ($size) $args['size'] = $size; if ($user && method_exists($user, 'getName')) $args['name'] = (string) $user->getName(); return $args; }
[+]
..
[-] functions.php
[edit]
[-] avatar-initials.php
[edit]
[-] version-notification.php
[edit]
[-] .htaccess.disabled
[edit]