tags:

views:

79

answers:

1

I was wondering if anyone knows how I could remove or replace these annoying N over L (I'm guessing means newline) from my php string before printing them to an image.

the text looks like this

any help much appreciated as I have wasted hours on this little problem...

<?php
exec('/usr/games/fortune -s', $fortune);
for($i = 0; $i <= count($fortune); $i++) {
    $text = "$text $fortune[$i]";
}
$image = imagecreatefrompng("rex.png");
$color = imagecolorallocate($image, 0, 0, 0);
$newtext = wordwrap($text, 35, "\n", true);
$newertext2 = explode  ("\n", $newtext);
imagestring  ($image, 3, 0, 0, $newertext2[0], $color);
imagestring  ($image, 3, 0, 11, $newertext2[1], $color);
imagestring  ($image, 3, 0, 22, $newertext2[2], $color);
imagestring  ($image, 3, 0, 33, $newertext2[3], $color);
imagestring  ($image, 3, 0, 44, $newertext2[4], $color);
imagestring  ($image, 3, 0, 55, $newertext2[5], $color);
imagestring  ($image, 3, 0, 66, $newertext2[6], $color);
imagestring  ($image, 3, 0, 77, $newertext2[7], $color);
header("Content-type: image/png");
imagepng($image);
?>
+1  A: 

Hello Austin,

$newertext2 = explode ("\n", $newtext); imagestring ($image, 3, 0, 0, $newertext[0], $color);

Shouldn't you print the letters in newertext2 instead of newertext ?

Alex
heh, yeah, i just made that edit before I posted and hadn't saved it yet. editing now.
austin
also, that has nothing to do with the problem i'm having. just me not looking before i post.
austin