Cragsterboy Posted November 1, 2008 Share Posted November 1, 2008 ok i was following this : http://www.phpjabbers.com/put-watermark-on-images-using-php-php20.html so i could create an image with custom text on it. But i want the custom text i want on it is an output from the following code: <? $results = explode("\n", trim($results)); echo '<table><td>'; // Start a table echo $Player1."</td><td>".$Player2."</td></tr><tr><td>"; $size = count($results); $valBreak = '</td><td>'; // Set the value that will be put between the values for($i = 0; $i < $size; ++$i) { echo $results[$i]; // See if the next value starts with '-' and output it if it is if(isset($results[$i+1]) && $results[$i+1][0] == '-') { echo ' ' . $results[$i+1]; ++$i; // Move the pointer up one since we've outputted 2 values this loop } // Output the between-item value if it isn't the last loop of the array if(isset($results[$i+1])) { echo $valBreak; } // Swap the between-item value every other loop $valBreak = ($valBreak == '</td><td>') ? '</td></tr><tr><td>' : '</td><td>'; } echo '</td></tr></table>'; // End the table ?> how do i do this? Thanks, ~Crag Link to comment https://forums.phpfreaks.com/topic/131008-echo-text-onto-image-problem/ Share on other sites More sharing options...
Barand Posted November 1, 2008 Share Posted November 1, 2008 Store the text in a variable and pass it to your image code. $str = "text I want on the image" echo "<img src='myimagecode.php?text=$str' />"; Link to comment https://forums.phpfreaks.com/topic/131008-echo-text-onto-image-problem/#findComment-680163 Share on other sites More sharing options...
Cragsterboy Posted November 1, 2008 Author Share Posted November 1, 2008 yes this is my problem i dont know who to make the output text of the code i have given become a string Thanks, ~Crag Link to comment https://forums.phpfreaks.com/topic/131008-echo-text-onto-image-problem/#findComment-680177 Share on other sites More sharing options...
Barand Posted November 1, 2008 Share Posted November 1, 2008 $str = ''; // start with empty string var then instead of echo "This is the text I want"; you append it to the string var $str .= "This is the text I want"; Link to comment https://forums.phpfreaks.com/topic/131008-echo-text-onto-image-problem/#findComment-680252 Share on other sites More sharing options...
Cragsterboy Posted November 1, 2008 Author Share Posted November 1, 2008 humm ive tried what you suggested but no success, so im going to explain fully what my script does. So far atm it converts a duel report into a table layout so it looks nice, you can see it here: http://cakeisalie.info/westconverter/image.php the output it gives i would like it to go onto an image sorry about this but im a bit of a noob at php Thanks, ~Crag Link to comment https://forums.phpfreaks.com/topic/131008-echo-text-onto-image-problem/#findComment-680286 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.