• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Real Tibia Letters for Gesior ACC News

PHP:
function changeFirstLetter($string,$path='',$ext='.gif',$checkIfFileExists=false)
		{
			$tpl = "<img src='{path}' alt='' title=''/>";
			if(is_string($string) && strlen($string)>0)
			{
				$string = ucfirst($string);
				$ASCII  = ord($string[0]);
				//if($ASCII > 0x40 && $ASCII < 0x5A)
				if(preg_match('/^[A-Z]{1}/',$string))
				{
					$path   = $path.$ASCII.$ext;
					if(file_exists($path) || !$checkIfFileExists)
					{
						$string = str_replace($string[0],$tpl,$string);
						$string = str_replace('{path}',$path,$string);
					}
				}
			}			
			return $string;
		}

usage

changeFirstLetter('hello tibia','path/to/img','.jpg');


about the colors I recommend you to use

PHP:
<p style="color:red;"></p>
or
PHP:
<p style="color:RGB(255,0,0);"></p>

instead of font tag which is very old and does not exists in XHTML.
 
Here is the automatic working one :)

PHP:
<?
$content = strtoupper('Hi my name is Paxton');
for ($i = 0; $i < strlen($content); ++$i)
{
	if($content[$i] == " ")
	echo "&nbsp;&nbsp;&nbsp;&nbsp;";
	else
	echo "<img src='http://static.tibia.com/images/global/letters/letter_martel_$content[$i].gif' />";
}
?>

In:
PHP:
$content = strtoupper('Hi my name is Paxton');

Write your sentence. :thumbup:

In what .php i put that?:O
 
2rz5my8.jpg
 
this is cool, thanks dude!
PHP:
function TibiaFirstLetter($str){
$tmp=$str[0];
$tmp='<img alt="'.$tmp.'" src="letters/'.strtoupper($tmp).'.gif" />';
$str=substr($str,1);
$str=$tmp.$str;
return $str;
}
PHP:
function TibiaAllLetter($str){
$ret='';
$str=str_split($str,1);
foreach($str as $chr){
if(stripos($chr,'abcdefghijklmnopqrstuvwxyz')===false){
$ret.=$chr
} else {
$ret.='<img alt="'.$chr.'" src="letters/'.strtoupper($chr).'.gif" />';
}
}
return $ret;
}
i guess :p
 
Back
Top