Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Zamiana tła
uhutaf
post 8.08.2010, 15:02:21
Post #1





Grupa: Zarejestrowani
Postów: 36
Pomógł: 1
Dołączył: 14.08.2009

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


Witam! Mam skrypt, który ma zamienić białe tło na przezroczyste. Ale nie działa. Oto poniższy kod:
  1. $pocz = "../img/przeciwnicy/";
  2. $file = "krolik.gif";
  3. header("Content-type: image/gif");
  4. $kolorbialy = imagecolorallocate ($file, 255, 255, 255);
  5. imagecolortransparent ($file, $kolorbialy);
  6. imagegif ($file, $pocz);

Czy możecie pomóc?


PS: Cały skrypt jest większy, ale dla testów dałem tylko ten mały. Niżej daję cały:
  1. $pocz = "../img/przeciwnicy/";
  2. if ($folder = opendir($pocz)){
  3. while (false !== ($file = readdir($folder))){
  4. if ($file != "." && $file != ".."){
  5. $ros = explode(".",$file);
  6. $ostros = count($ros)-1;
  7. if($ros[$ostros] == "gif" || $ros[$ostros] == "png"){
  8. header("Content-type: image/".$ros[$ostros]);
  9. $kolorbialy = imagecolorallocate ($file, 255, 255, 255);
  10. imagecolortransparent ($file, $kolorbialy);
  11. if ($ros[$ostros] == "gif")
  12. imagegif ($file, $pocz);
  13. else
  14. imagepng ($file, $pocz);
  15. }
  16. }
  17. }
  18. closedir($folder);
  19. }
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: 16.07.2025 - 08:06