jnerotrix Posted March 1, 2009 Share Posted March 1, 2009 hello I have a script that takes ip's and puts them into a text file php gets the ip checks if its already in the file ip.txt if it is not in the file it adds the ip to ip.txt on a new line then another script counts the number of lines. I need the Number of Lines Counted to show up on the image heres all the codes so far ------------ Files: visits.php track.php ip.txt index.php and heres the image i need the text to show up on I need the Text to Show up Next to Total Visits but i dont know how Visit.php <?php include('track.php'); $file = "ip.txt"; $users = count(file($file)); $string = $users; $im = imagecreatefrompng('./track.png'); $textColor = imagecolorallocate ($im, 255, 255, 255); imagestring($im, 5, 0, 0, "$string", $textColor); header ("Content-type: image/png"); imagepng($im); ?> track.php <?php $ip = $_SERVER['REMOTE_ADDR']; $myFile = "ip.txt"; $lines = file($myFile); $lines = array_map('trim',$lines); if(!in_array($ip,$lines)){ $fh = fopen($myFile, 'a') or die("can't open file"); $stringData = "$ip\r\n"; fwrite($fh, $stringData); fclose($fh); } ?> then theres ip.txt and index.php <center> <br><br><br> <h1> Numbmer Of Visited Users Test <br> <?php include ('visits.php'); ?> </center> All I see on the page is The Image "http://joeyelectric.comuf.com/search/index.php" Could Not Be Displayed Because it Contains Errors Please Help Thanks, jnerotrix Quote Link to comment https://forums.phpfreaks.com/topic/147414-text-on-an-image-help-please/ Share on other sites More sharing options...
jnerotrix Posted March 1, 2009 Author Share Posted March 1, 2009 I just get an errors thing and i dont know what to put for numbers on the 5,0,0 Please help thanks Quote Link to comment https://forums.phpfreaks.com/topic/147414-text-on-an-image-help-please/#findComment-773756 Share on other sites More sharing options...
Stephen68 Posted March 1, 2009 Share Posted March 1, 2009 Try reading up here, I didn't read it myself but it should give the info. you are looking for http://blog.ninedays.org/2007/11/29/writing-text-to-images-with-php/ http://discomoose.org/2005/10/19/write-text-on-to-an-existing-png-image-using-php/ Hope this helps some Quote Link to comment https://forums.phpfreaks.com/topic/147414-text-on-an-image-help-please/#findComment-773768 Share on other sites More sharing options...
jnerotrix Posted March 1, 2009 Author Share Posted March 1, 2009 This Stuff is soo confusing do you guys see anything wrong with my codes >.< Quote Link to comment https://forums.phpfreaks.com/topic/147414-text-on-an-image-help-please/#findComment-773774 Share on other sites More sharing options...
.josh Posted March 1, 2009 Share Posted March 1, 2009 I just get an errors thing and i dont know what to put for numbers on the 5,0,0 Please help thanks How about reading the manual for what the imagestring arguments are. Quote Link to comment https://forums.phpfreaks.com/topic/147414-text-on-an-image-help-please/#findComment-773796 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.