Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Banalny problem z imagecolorallocate(), ?
PiNkOs
post
Post #1





Grupa: Zarejestrowani
Postów: 76
Pomógł: 4
Dołączył: 27.02.2009

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


Witam,

Mam dosyć dziwny problem z uruchomieniem tego skryptu:

  1. <?php
  2. $im = imagecreate(100, 100) or die("Błąd! Identyfikator błędu: #01");
  3. $bg = imagecolorallocate($im, 255, 0, 0) or die("Błąd! Identyfikator błędu: #02");
  4. ?>


Wyświetla mi: Błąd! Identyfikator błędu: #02, a powinno wyświetlić kwadrat 100x100 w kolorze czerwonym

Jeżeli chodzi o bibliotekę GD na serwerze:

GD Version: bundled (2.0.28 compatible)
FreeType Support: Enabled
FreeType Linkage: with freetype
T1Lib Support: Enabled
GIF Read Support: Enabled
GIF Create Support: Enabled
JPG Support: Enabled
PNG Support: Enabled
WBMP Support: Enabled
XBM Support: Enabled
JIS-mapped Japanese Font Support: Disabled

Ten post edytował PiNkOs 23.03.2010, 15:57:56
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
zordon
post
Post #2





Grupa: Zarejestrowani
Postów: 358
Pomógł: 78
Dołączył: 4.11.2008
Skąd: Kraków

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


  1. header ('Content-type: image/png');
  2. $im = imagecreate(100, 100) or die("Błąd! Identyfikator błędu: #01");
  3.  
  4. $bg = imagecolorallocate($im, 255, 0, 0);
  5.  
  6. $img = imagepng($im);


to już działa. nie jestem pewien, ale wydaje mi się, że przez zmianę w funkcji imagecollorallocate:
Changelog
Version Description
Prior to 5.1.3 Returns -1 if the allocation failed.

czyli po prostu funkcja zwraca ci 0, a kod błędu to -1

Ten post edytował zordon 23.03.2010, 16:57:53
Go to the top of the page
+Quote Post
PiNkOs
post
Post #3





Grupa: Zarejestrowani
Postów: 76
Pomógł: 4
Dołączył: 27.02.2009

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


THX, niby takie proste...
Go to the top of the page
+Quote Post

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: 22.08.2025 - 17:25