$l) $l = strlen($n); elseif (strlen($n) < $l) $p = $l - strlen($n); $img = imagecreate(26 * $l, 28); $bg = imagecolorallocate($img, 5, 5, 5); $num = imagecreatefrompng("digits.png"); $o = $p; $na = str_split($n); foreach ($na as $x) { $x = intval($x); $y = floor($x / 5) * 28; $x = ($x % 5) * 26; imagecopy($img, $num, $o * 26, 0, $x, $y, 26, 28); $o++; } imagecolortransparent($img, $bg); header("Content-type: image/png"); imagepng($img); imagedestroy($img); imagedestroy($num);