Ben yazdı:
$im = imagecreatefromstring($im_string);
return imagegif($im,'a.gif');
The content of variable $im_string
I get from a ZIP file.
It should work, but it returns '1'.
Neden sebebi nedir?
imagegif
function bir boolean verir, bu yüzden bir dönüş değeri 1 başarılı olduğunu işaret eder.
Eğer asıl görüntü verilerini dönmek gerekirse, siz de ikinci parametre geçmek ve dosyadan veri okumak, ya da fonksiyon çıkışını tampon gerekir.
<?php
ob_start();
$im = imagecreatefromstring($im_string);
imagegif($im);
$img_data = ob_get_clean();
return $img_data;
?>
Veya:
<?php
$im = imagecreatefromstring($im_string);
imagegif($im, 'a.gif');
$img_data = file_get_contents('a.gif');
return $img_data;
?>
php manual imagegif getirilerine göre aşağıdaki gibi:
Değerler Dönüş
Returns TRUE on success or FALSE on failure.
Eğer geri dönmek için ne bekliyordun ki? Görüntü verileri?
Edit: To answer the question in the comment. To output the actual data you should either not have the second argument (which sends it to the file a.gif) so that it sends the data straight to the output or you pick up that a.gif and sends the data in there. In both cases you need to remember to send a correct content-type header back to the client as well.