Hello. I am trying to convert text into images using this script.
I will be using it for the headers on my site. I wanted to use this method so I could in theory type in anything for the header and each character would be replaced with the location of an image.
For example;
Login
becomes;
L.gif o.gif g.gif i.gif n.gif
Upon running this script I found out that it does not only change the letter in the text but it changes all of the characters in the image tags like so: Link here
I was wondering if there was a way to modify the script so that only the L, o, g, i, n, was changed. You can see the script below. Any comments are much appreciated and if anyone has a beter method of how to do this then I would be more than happy to hear them out.
<?php
// Array.
$header_text = array(
'l' => "<img src='images/text/d.gif'>",
'o' => "<img src='images/text/d.gif'>",
'g' => "<img src='images/text/d.gif'>",
'i' => "<img src='images/text/d.gif'>",
'n' => "<img src='images/text/n.gif'>"
);
// text
$text = 'login';
echo convert_header_text( $text );
function convert_header_text( $t )
{
$search = array_keys( $GLOBALS['header_text'] );
$t = str_replace( $search, $GLOBALS['header_text'], $t );
return $t;
}
?>
Thanks in advance.
Matt.