Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Generowanie obrazka
djgarsi
post
Post #1





Grupa: Zarejestrowani
Postów: 459
Pomógł: 26
Dołączył: 1.06.2009

Ostrzeżenie: (0%)
-----


Witam.
Mam pewien kod, który powinien generować mi grafikę, coś a'la demotywator. Niestety, błędów nie pokazuje a tylko Obrazek „http://localhost/new/index.php” nie może zostać wyświetlony, ponieważ zawiera błędy.

Oto mój kod:

  1. ini_set( 'display_errors', 'On' );
  2. error_reporting( E_ALL );
  3.  
  4. header("Content-type: image/png");
  5.  
  6. $tytul = "tytuł";
  7. $opis = "Jakiś dłuuuuugi opis";
  8.  
  9. $caly_obraz = imagecreatetruecolor(750, 600);
  10. $grafika = imagecreatefromjpeg('sunset.jpg');
  11.  
  12. $czarny = imagecolorallocate($caly_obraz, 0, 0, 0);
  13. $bialy = imagecolorallocate($caly_obraz, 255, 255, 255);
  14. $stopka[0] = imagecolorallocate($caly_obraz, 128, 128, 128);
  15. $stopka[1] = imageloadfont('arial.gdf');
  16. $czcionka = 'arial.ttf';
  17.  
  18. imagefill($caly_obraz, 0, 0, $czarne_tlo);
  19. imagefilledrectangle($caly_obraz, 70, 45, 680, 455, $bialy);
  20. imagefilledrectangle($caly_obraz, 72, 47, 678, 453, $czarny);
  21.  
  22. imagestring($caly_obraz, $stopka[1], 660, 585, 'strona.pl', $stopka[0]);
  23. imagestring($caly_obraz, $stopka[1], 10, 585, 'Garsi', $stopka[0]);
  24. imagettftext($caly_obraz, 46, 0, 200, 510, $bialy, $czcionka, $tytul);
  25. imagettftext($caly_obraz, 16, 0, 100, 555, $bialy, $czcionka, $opis);
  26.  
  27. imagecopy($caly_obraz, $grafika, 72, 47, 0, 0, 606, 406);
  28.  
  29. imagepng($caly_obraz);
  30. imagedestroy($caly_obraz);
  31. imagedestroy($grafika);


Co jest w nim nie tak?


--------------------
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 21:38