Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] obrazek generowany przez skrypt
marian2299
post
Post #1





Grupa: Zarejestrowani
Postów: 272
Pomógł: 9
Dołączył: 6.06.2009

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


Cześć,

piszę, dlatego że chciałbym zrobić obrazek z cytatem. Cytaty miałby się losować z pliku .txt i wyświetlać się na obrazku o określonej czcionce itp. Miałyby też być w odpowiednim miejscu, lekko z prawej strony. Wie ktoś może, jak to zrobić? <prosi o przykładowy kod>


Pozdrawiam (IMG:style_emoticons/default/smile.gif)
M.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
marian2299
post
Post #2





Grupa: Zarejestrowani
Postów: 272
Pomógł: 9
Dołączył: 6.06.2009

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


GD jest zainstalowane,

text/plain mi się nie wyświetla, plik zaczyna się pobierać ;O

Okej, uzyskałem taki, działający, kod:

  1. <?php
  2. header("Content-type: image/jpeg");
  3. $obrazek = ImageCreateFromJpeg("lesmis.jpeg");
  4.  
  5. $cytaty = "Whether true or false, what is said about men often has as much influence on their lives, and particularly on their destinies, as what they do.|If the soul is left in darkness, sins will be committed. The guilty one is not he who commits the sin, but the one who causes the darkness.|In passing, we might say that success is a hideous thing. Its false similarity to merit deceives men...They confuse heaven's radiant stars with a duck's footprint left in the mud.|All things considered, sire, there is nothing to fear from these people. They are as carefree and lazy as cats. The lower classes in the provinces are restless, those in Paris are not...They are not dangerous. In sum: dependable riffraff.";
  6. $losowycytat = explode("|", $cytaty);
  7.  
  8. $losowycytat1 = $losowycytat[rand(0, count($losowycytat)-1)];
  9.  
  10.  
  11. $rozmiar = 10;
  12. $pochylenie = 0;
  13. $x = 136;
  14. $y = 35;
  15. putenv('GDFONTPATH=' . realpath('.'));
  16. $font = 'georgia.TTF';
  17. $white = imagecolorallocate($obrazek, 255, 255, 255);
  18. imagettftext($obrazek, $rozmiar, $pochylenie, $x, $y, $white, $font, $losowycytat1);
  19. ImageJpeg($obrazek);
  20. ?>


Tylko... da się jakoś sprawić, żeby tekst się zawijał?
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 6.10.2025 - 20:06