Hi.
Im trying to make a shout box that displays the posts in a GD image.
The problem im having is as the script posts the shouts to a txt file they get posted to the bottom of the text file. this means after the 5th post any new posts dissapear off the bottom on the image and are invisible.
What i need to do it have the script create the image showing only the bottom 5 posts from the txt list so that the newest post is visible at the bottom of the image and the old posts dissapear out of the top of the image.
This is the code i have getting the posts and displaying them in the image
<?php
// shout sig
header("Content-type: image/png");
$file = file('shouts.txt');
$im = @imagecreate(550, 120)
or die("Error! Could not create image stream.s");
$background_color = imagecolorallocate($im, 0, 0, 0);
$text_color = imagecolorallocate($im, 0, 255, 0);
$i = 1;
$j = 0;
foreach ($file as $line_num => $line) {
if($i <= count($file)-1)
imagestring($im, 2, 5, $j, substr($line, 0, strlen($line)-1), $text_color);
else
imagestring($im, 2, 5, $j, $line, $text_color);
$j+=15;
$i++;
}
imagepng($im);
imagedestroy($im);
?>
Could someone tell me how to change it please?
any help would be great.