mam problem z funkcją imagegif, imagepng, itp.
Oto plik http://www.ii.uni.wroc.pl/~rno/zmn2/index.php
Kod
<HTML>
<BODY>
<?PHP
///// Tworzenie zwykłego pliku
///// A
/////
printf("Creating file ...");
$file = fopen("tmpfile.txt", "w");
fwrite($file, "Ala ma kota.");
fclose($file);
printf(" DONE<BR>\n");
///// Tworzenie zwykłego pliku
///// B
/////
printf("Creating file ...");
$file = fopen("image.gif", "w");
fwrite($file, "Ala");
fclose($file);
printf(" DONE<BR>\n");
///// Tworzenie obrazka
///// C
/////
printf("Creating gif image ... ");
$im = @imagecreate(110, 20)
or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 0, 0, 0);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, "A Simple Text String", $text_color);
if (imagegif($im, "image.gif"))
{
imagedestroy($im);
printf("DONE<BR>\n");
}
else
printf("FAILED<BR>\n");
?>
</BODY>
</HTML>
<BODY>
<?PHP
///// Tworzenie zwykłego pliku
///// A
/////
printf("Creating file ...");
$file = fopen("tmpfile.txt", "w");
fwrite($file, "Ala ma kota.");
fclose($file);
printf(" DONE<BR>\n");
///// Tworzenie zwykłego pliku
///// B
/////
printf("Creating file ...");
$file = fopen("image.gif", "w");
fwrite($file, "Ala");
fclose($file);
printf(" DONE<BR>\n");
///// Tworzenie obrazka
///// C
/////
printf("Creating gif image ... ");
$im = @imagecreate(110, 20)
or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 0, 0, 0);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, "A Simple Text String", $text_color);
if (imagegif($im, "image.gif"))
{
imagedestroy($im);
printf("DONE<BR>\n");
}
else
printf("FAILED<BR>\n");
?>
</BODY>
</HTML>
Po wejściu na stronę http://www.ii.uni.wroc.pl/~rno/zmn2/index.php
Dostaję odpowiedź:
Kod
Creating file ... DONE
Creating file ... DONE
Creating gif image ...
Warning: imagegif() [function.imagegif]: Unable to open 'image.gif' for writing in /opt/www/users/rno/zmn2/index.php on line 25
FAILED
Creating file ... DONE
Creating gif image ...
Warning: imagegif() [function.imagegif]: Unable to open 'image.gif' for writing in /opt/www/users/rno/zmn2/index.php on line 25
FAILED
Dlaczego imagegif zwraca błąd Unable to open 'image.gif' for writing
Wylistowanie katalogu http://www.ii.uni.wroc.pl/~rno/zmn2/ daje następujący wynik:
Kod
/usr/local/htdocs/rno/zmn2 > ls -al
total 10
drwxrwxrwx 2 rno nobody 512 wrz 30 11:42 .
drwxrwx--- 32 rno nobody 2048 wrz 28 06:18 ..
-rw-rw-rw- 1 nobody nobody 0 wrz 30 11:47 image.gif
-rw-r--r-- 1 rno dokt 763 wrz 30 11:32 index.php
-rw-rw-rw- 1 nobody nobody 12 wrz 30 11:47 tmpfile.txt
total 10
drwxrwxrwx 2 rno nobody 512 wrz 30 11:42 .
drwxrwx--- 32 rno nobody 2048 wrz 28 06:18 ..
-rw-rw-rw- 1 nobody nobody 0 wrz 30 11:47 image.gif
-rw-r--r-- 1 rno dokt 763 wrz 30 11:32 index.php
-rw-rw-rw- 1 nobody nobody 12 wrz 30 11:47 tmpfile.txt