Nandini Posted September 20, 2008 Share Posted September 20, 2008 Hi i want to create text image using php. Its all are working fine. But when i am trying to multi line text its not working. If i am use '\n' and '<br>' image displayed as it is \n and <br>. Here is my scripts. Can i anyone guide me. <? header("Content-type: image/png"); // Tell the browser it's an image, not a .php file. $text = 'Sample text\nSample text'; $number = strlen($text); // Count the chars in the text. $number = ($number*7)+9; // Times this by 7 and add 9 to make it look the right size. $im = imagecreate($number, 24); // Create the basic size, $number x 24 $colour1 = imagecolorallocate($im, 0, 0, 0); // Background (RGB) black. $colour2 = imagecolorallocate($im, 255, 255, 255); // Background white. imagestring($im, 3, 5, 5, $text, $colour2); // Add the text to the image. imagepng($im); // Create and display the image. imagedestroy($im); // Cast the image from the server (will cause lag eventually if you don't). ?> Thanq Link to comment https://forums.phpfreaks.com/topic/125104-create-text-image-using-php/ Share on other sites More sharing options...
Adam Posted September 20, 2008 Share Posted September 20, 2008 try: $text = 'Sample text' ."\n". 'Sample text'; Link to comment https://forums.phpfreaks.com/topic/125104-create-text-image-using-php/#findComment-646550 Share on other sites More sharing options...
Nandini Posted September 20, 2008 Author Share Posted September 20, 2008 Hi thanx for ur quick reply. By using '\n' i got the image as V above T in the place of \n. By using '<br>', as it is <br> printing Link to comment https://forums.phpfreaks.com/topic/125104-create-text-image-using-php/#findComment-646556 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.