['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => '/^\d+\.jpg$/'] ], 'size' => ['filter' => FILTER_CALLBACK, 'options' => [self::class, 'checkTextLine']] ); public function __construct(string $rawParam) { parent::__construct($rawParam); if (!Cfg::get('PROFILER_ENABLE')) $this->generate404(); } /* params id: size: [optional] return: */ protected function generate() : void { if (!$this->assertGET('id')) $this->generate404(); $profileId = substr($this->_get['id'], 0, -4); $charData = DB::Aowow()->selectRow('SELECT `race`, `gender` FROM ::profiler_profiles WHERE id = %i', $profileId); if (!$charData) $this->generate404(); $gender = $charData['gender'] ? 'female' : 'male'; $race = ChrRace::tryFrom($charData['race'])?->json() ?? 'human'; $size = match($this->_get['size']) { 'small', 'medium', 'large' => $this->_get['size'], default => 'medium' }; $this->redirectTo = sprintf('%s/images/armory/%s/default_%s_%s.jpg', Cfg::get('STATIC_URL'), $size, $race, $gender); } } ?>