witam
szukam skryptu ktory potrafil by wyswietlac cytat jako obrazek (forma dowolna byla graficzna tongue.gif).
i zeby byl wielolinijkowy. doszedlem do tego jak zrobic zeby byla 1 linijka ale ni ewiem jak zrobic zeby byly 2 smile.gif
chodzi o to zeby skrypt pobieral z pliku cytaty i sam dzielil na 2 linijki (np. \n w cytacie powoduje nowa linie, czy jakikolwiek inny)
mam nadzieje ze jasno sie wyrazilem i ktos to zrozumie smile.gif
z gory dzieki

ponizej kod mniej wiecej dziala smile.gif (bez zmiennej py bo narazie i tak nie potrzebna sad.gif)

  1. <?php
  2. header (&#092;"Content-type: image/png\");
  3.  
  4. $fileLines = file(&#092;"file.txt\");
  5. $count = count($fileLines);
  6.  
  7. srand((double)microtime()*1000000);
  8. $i = rand(0,($count-1));
  9.  
  10. $string = $fileLines[$i];
  11.  
  12. $px = strlen($string) * 7.5;
  13.  
  14. $im = @imagecreate ($px, 80) or die (&#092;"Cannot Initialize new GD image stream\");
  15.  
  16. $background_color = imagecolorallocate ($im, 255, 255, 255);
  17. $trans=imagecolortransparent($im,$background_color);
  18. $text_color = imagecolorallocate ($im, 0, 0, 255);
  19. imagestring ($im, 2, 5, 10, $string, $text_color);
  20. imagepng ($im);
  21. ?>


EDIT:
Po paru godzinach opanowałem problem smile.gif
Komentarze mile widziane - nie wiem czy dobrze to rozwiązałem.

  1. <?php
  2. $fontsize = 5;
  3. $fileLines = file(&#092;"file.txt\");
  4. $count = count($fileLines);
  5. srand((double)microtime()*1000000);
  6. $i = rand(0,($count-1));
  7.  
  8. $string = $fileLines[$i];
  9. $string = preg_replace(&#092;"/r?n$|r[^n]$/\", \"\", $string); 
  10. $lines = explode(&#092;"||\",$string);
  11. $arraycount = sizeof($lines);
  12.  
  13. $largestLine = 0 ;
  14. for ($aa = 0 ; $aa < $count ; $aa++)
  15. {
  16. if (strlen($lines[$aa]) > $largestLine)
  17. $largestLine = strlen($lines[$aa]);
  18. }
  19.  
  20. $px = ($largestLine + $fontsize) * 7.+ 4;
  21. $py = $arraycount * 13;
  22. $im = @imagecreate ($px, $py) or die (&#092;"Cannot Initialize new GD image stream\");
  23.  
  24. $background_color = imagecolorallocate ($im, 255, 255, 255);
  25. $trans=imagecolortransparent($im,$background_color);
  26.  
  27. $text_color = imagecolorallocate ($im, 0, 0, 255);
  28. $iy = 0 ;
  29.  
  30. foreach ($lines as $x)
  31. {
  32. imagestring ($im, 4, $fontsize, $iy, $x, $text_color);
  33. $iy = $iy + 10 ;
  34. }
  35.  
  36. header (&#092;"Content-type: image/png\");
  37. imagepng ($im);
  38. ?>