Hey all
Trying to create an image dynamically using the gd library
function create_gif_text($image,$text,$r='255',$g='255',$b='255', $font_no=3)
{
header("Content-type: image/gif");
$string = $text;
$im = imagecreatefromgif($image);
$colour = imagecolorallocate($im, $r, $g, $b);
$px = (imagesx($im) - 6 * strlen($string)) / 2;
imagestring($im, $font_no, $px, 5, $string, $colour);
imagegif($im);
imagedestroy($im);
}
When i call this function in a script on its own it works as long as there isn't a carriage return at the top of the page, when i call as part of another function i get the following output in the browser
GIF89açôúþñ÷ýð÷üÞñýÔçøÓçøÐãö³àú’ÒùÉï™Åí}Êø¼éÿÿÿÅüÅûÄúÄûiÂ÷]Ãú\Âú[ÁùZÀùZÀøY¿øX¾øX¾÷½÷W½÷V¼÷U»öTºör²éS¹öS¹õR¸õQ·ôQ·õP¶ôOµóOµôN´ók«åM³òM³óL²òJ°òK±òI¯ñJ°ñH®ñH®ðGðF¬ïE«ïE«îDªîY¥æC©íC©îB¨íA§ìßA§í@¦ì?¥ì?¥ë>¤ë=£ë<¢ê;¡ê: éO›à: ê9Ÿé8žè8žé7è6œç5›ç5›æ4šæ3™æ3™å2˜å1—ä0–ã0–ä/•ã.”ã.”â,’â7Þ-“â+‘á1à@ŒÙ*á5ŽÝ)á)à(Žà'à'ß&Œß%‹ß%‹Þ*ŠÜ$ŠÞ#‰Ý#‰Þ"ˆÝ!‡Ý †Ý †Ü…Ü%„Ú„Ü„Û"؃ۂÚÚ€ÙÙØ~Ø}×}Ø|× yÒ{Ö{×yÖzÖxÕyÕwÕvÔvÕuÔtÔtÓ sÓ rÒ qÒ qÑpÏ pÑ oÐ oÑnÐmÏlÏlÎkÎjÍjÎiÍhÍgÌfÌÿÿÿ!ù¢,þE‰€Ã‡ƒ&LĈ±#ˆ‘%Q¬l1óD¢lèÀ±cB5xQò¤J2lä¬)0PbVx‰âÅŒB’8¡’%L8xÄ8àÄ£G/t(ÁÆ FšLÁâ Ð> ÀŒÀ•ëL)bØèQ"U4oððA2bkW®B„AÖlÕ7vøÑÁÂÛ3G4µ¤¬”³iû2ñ!C†·<h!‡C©XÂXÅãÇPŠ#‹Î0"Eƒ:†Ù©%Œš8yüzñ¢D‰ŽFœ8Ý 0(&˸™£çÏ!2X° Áœyƒ§‡$ÁìåÌ›:{%²ac¡wï6Nþ?ŒbrŒš«†ýøQ£½ûö`;
I want to build a class for creating and handling different types of image, and this was just a test function
Any help would be appreciated
Thanks
Tim