Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> grafika, tak tak, dział dobry.. ;)
marcinvx
post 22.02.2011, 20:47:13
Post #1





Grupa: Zarejestrowani
Postów: 19
Pomógł: 0
Dołączył: 11.02.2011

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


  1. <?php
  2. // Create a 300x100 image
  3. $im = imagecreatetruecolor(300, 100);
  4. $red = imagecolorallocate($im, 0xFF, 0x00, 0x00);
  5. $black = imagecolorallocate($im, 0x00, 0x00, 0x00);
  6.  
  7. // Make the background red
  8. imagefilledrectangle($im, 0, 0, 299, 99, $red);
  9.  
  10. // Path to our ttf font file
  11. $font_file = './arial.ttf';
  12.  
  13. // Draw the text 'PHP Manual' using font size 13
  14. imagefttext($im, 13, 0, 105, 55, $black, $font_file, 'PHP Manual');
  15.  
  16. // Output image to the browser
  17. header('Content-Type: image/png');
  18.  
  19. imagepng($im);
  20. imagedestroy($im);
  21. ?>

Jak zrobić że zamiast czarnego tła jest obrazek ?
Go to the top of the page
+Quote Post
tehaha
post 22.02.2011, 20:53:28
Post #2





Grupa: Zarejestrowani
Postów: 1 748
Pomógł: 388
Dołączył: 21.08.2009
Skąd: Gdynia

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


masz funkcję http://php.net/manual/en/function.imagecopymerge.php
Go to the top of the page
+Quote Post
marcinvx
post 22.02.2011, 21:13:40
Post #3





Grupa: Zarejestrowani
Postów: 19
Pomógł: 0
Dołączył: 11.02.2011

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


Mam tak:
  1. <?php
  2. // Create image instances
  3. $dest = imagecreatefromgif('sygnaturka.gif');
  4. $src = imagecreatefromgif('sygnaturka.gif');
  5.  
  6. // Copy and merge
  7. imagecopymerge($dest, $src, 10, 10, 0, 0, 0, 452, 122);
  8.  
  9.  
  10. $red = imagecolorallocate($src, 0xFF, 0x00, 0x00);
  11.  
  12. $font_file = './arial.ttf';
  13.  
  14. // Draw the text 'PHP Manual' using font size 13
  15.  
  16. imagefttext($src, 13, 0, 105, 55, $red, $font_file, 'PHP Manual');
  17. // Output and free from memory
  18. header('Content-Type: image/gif');
  19. imagegif($dest);
  20.  
  21. imagedestroy($dest);
  22. imagedestroy($red);
  23. imagedestroy($src);
  24. imagedestroy($font_file);
  25. ?>


Zadne błędy nie wyskakują, ale text sie na obrazu nie pokazuje. ;/
help me. ;D

Ten post edytował marcinvx 22.02.2011, 21:14:42
Go to the top of the page
+Quote Post
tehaha
post 22.02.2011, 21:21:37
Post #4





Grupa: Zarejestrowani
Postów: 1 748
Pomógł: 388
Dołączył: 21.08.2009
Skąd: Gdynia

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


no bo tekst przypisujesz do $src a wyświetlasz $dest
Go to the top of the page
+Quote Post
marcinvx
post 22.02.2011, 21:44:18
Post #5





Grupa: Zarejestrowani
Postów: 19
Pomógł: 0
Dołączył: 11.02.2011

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


aa, okej, Dzięki.. Już zrobiłem. smile.gif

  1. <?php
  2. // Create image instances
  3. $dest = imagecreatefromgif('sygnaturka.gif');
  4. $src = imagecreatefromgif('sygnaturka.gif');
  5.  
  6. // Copy and merge
  7. imagecopymerge($dest, $src, 10, 10, 0, 0, 122, 452, 0);
  8.  
  9.  
  10. $red = imagecolorallocate($src, 0x00, 0x00, 0x00);
  11.  
  12. $font_file = './arial.ttf';
  13.  
  14. // Draw the text 'PHP Manual' using font size 13
  15.  
  16. imagefttext($dest, 7, 0, 65, 58, $red, $font_file, '5');
  17. // Output and free from memory
  18.  
  19. header('Content-Type: image/gif');
  20. imagegif($dest);
  21.  
  22. imagedestroy($dest);
  23. imagedestroy($src);
  24. ?>


;//

a zeby nie robić kolejnego tematu to jak zrobić żeby jak wpiszę
http://nazwa-strony.pl/sygnatura.gif
to się wyświetli właśnie ten obrazek ?
To co wpisane ma być zmienne także zrobienie go jako tako na stałe odpada. ; P

Słyszałem ze coś z htaccess ale nie moge nic wyggooglować.. ;/
Go to the top of the page
+Quote Post
tehaha
post 22.02.2011, 21:50:42
Post #6





Grupa: Zarejestrowani
Postów: 1 748
Pomógł: 388
Dołączył: 21.08.2009
Skąd: Gdynia

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


przy pomocy mod_rewrite w .htaccess dajesz:
  1. RewriteEngine on
  2. RewriteRule ^([a-zA-Z]*).gif image.php?name=$1 [L]

następnie w skrypcie odbierasz nazwę zmienną $_GET['name']
Go to the top of the page
+Quote Post
marcinvx
post 23.02.2011, 19:39:11
Post #7





Grupa: Zarejestrowani
Postów: 19
Pomógł: 0
Dołączył: 11.02.2011

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


dobra, to zrobiłem..
A jak zrobić jeszcze żeby napisy były wyświetlane prawidłowo ?
Kod
http://gold-racing.pl/sygnaturka.gif


Proszę nie traktować jako raklamy. ;/

Aktualny skrypt wyżej. smile.gif

tzn zmieniłem tylko wielkosc czcionki.

Ten post edytował marcinvx 23.02.2011, 19:42:24
Go to the top of the page
+Quote Post
bim2
post 23.02.2011, 21:14:36
Post #8





Grupa: Zarejestrowani
Postów: 1 873
Pomógł: 152
Dołączył: 9.04.2006
Skąd: Berlin

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


Może za mała czcionka?


--------------------
Go to the top of the page
+Quote Post
marcinvx
post 23.02.2011, 21:50:19
Post #9





Grupa: Zarejestrowani
Postów: 19
Pomógł: 0
Dołączył: 11.02.2011

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


Z dużą jest tak samo. ;/

do tego na localhost/sygnaturka.php działa. ;/

może z serwerem coś nie tak ? ovh. ;/

Ten post edytował marcinvx 23.02.2011, 21:51:05
Go to the top of the page
+Quote Post

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 Wersja Lo-Fi Aktualny czas: 13.07.2025 - 04:19