Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php]problem z imagecreatefromgif
-hobibit-
post
Post #1





Goście







Nie działa mi fragment kodu z funkcją: imagecreatefromgif.

  1. <?php
  2. if (function_exists('imagecreatefromgif')){echo 'jest';}
  3. $obrazek_tymczasowy = imagecreatefromgif("pliki/qwe.gif");
  4. ?>


  1. jest
  2. Warning: imagecreatefromgif() [function.imagecreatefromgif]: 'pliki/qwe.gif' is not a valid GIF file in /home/hobibit/public_html/art/index.php on line 71


Fragment z phpinfo():
gd
GD Support enabled
GD Version bundled (2.0.34 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.1.9
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XPM Support enabled
XBM Support enabled
Powód edycji: dodanie tagu ~Cienki1980
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
bartg
post
Post #2





Grupa: Zarejestrowani
Postów: 226
Pomógł: 25
Dołączył: 4.07.2007
Skąd: Berlin

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


Wyraźnie pisze że ten obrazek nie jest gifem. Rozszerzen ie nie zmienia typów pliku ;p

Funkcja sprawdzająca typy plików: (by me)
  1. <?php
  2. function imagecreatefrom($sFile)
  3. {
  4. if(!file_exists($sFile))
  5. {
  6. die('Image doesn't not exists: '.$sFile);
  7. }
  8. $size = @getimagesize($sFile);
  9. switch ($size[2])
  10. {
  11. case IMAGETYPE_PNG:  
  12. $imgTmp = imagecreatefrompng($sFile);
  13. break;
  14. case IMAGETYPE_JPEG: 
  15. $imgTmp = imagecreatefromjpeg($sFile);
  16. break;
  17. case IMAGETYPE_GIF: 
  18. $imgTmp = imagecreatefromgif($sFile);
  19. break;
  20. default:
  21. die('Invalid image type: '.$size[2]);
  22. break;
  23. }
  24. return $imgTmp;
  25. }
  26. ?>


Ten post edytował bartg 11.03.2008, 18:36:18
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: 13.10.2025 - 16:46