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. }