false]; $im = @imagecreatefromstring($raw); if ($im === false) return ['ok' => false]; ob_start(); $ok = imagejpeg($im, null, $quality); $bytes = (string)ob_get_clean(); if (!$ok || $bytes === '') return ['ok' => false]; return [ 'ok' => true, 'bytes' => $bytes, 'uuid' => bin2hex(random_bytes(16)), 'hash' => hash('sha256', $bytes), ]; } }