draw line with php using coordinates from txt file

Posted by netmajor on Stack Overflow See other posts from Stack Overflow or by netmajor
Published on 2010-06-05T02:13:17Z Indexed on 2010/06/05 17:22 UTC
Read the original article Hit count: 227

Filed under:
|
|

I have file A2.txt with coordinate x1,y1,x2,y2 in every line like below :

204 13 225 59  
225 59 226 84  
226 84 219 111  
219 111 244 192  
244 192 236 209   
236 209 254 223  
254 223 276 258 
276 258 237 337  

in my php file i have that code. This code should take every line and draw line with coordinate from line. But something was wrong cause nothing was draw :/:

<?php
$plik = fopen("A2.txt", 'r') or die("blad otarcia");
while(!feof($plik))
{
   $l = fgets($plik,20);
   $k = explode(' ',$l);

   imageline ( $mapa , $k[0] , $k[1] , $k[2] , $k[3] , $kolor );
}
imagejpeg($mapa);
imagedestroy($mapa);
fclose($plik) ;
?>

If I use imagejpeg and imagedestroy in while its only first line draw. What to do to draw every line ?? Please help :)

© Stack Overflow or respective owner

Related posts about php

Related posts about line