Reply to Re: Can GD load an image from another php script?

Your name:

Reply:


Posted by Oli Filth on 10/09/59 11:36

Darkbyte [Work] said the following on 04/01/2006 09:20:
>> Assuming I'm going to put the stuff into a function, and assuming I'm
>> going to create a php script that just calls that function so I can
>> load the image directly from html code, how can it help me with
>> imagecreatefrompng()?
>> How could I use the function with imagecreatefrompng()?
>
>
>
> DONE!!! DONE!!! AUHAUHAUHAUHAUHAUHA LOOOOOOLLLLL :)
>
> function mystuff($width=1, $height=1)
> {
> $img = imagecreatetruecolor($width, $height);
> /* stuff here */
> imagepng($img);
> }
>
> $img = imagecreatefromstring(mystuff(320, 200));
> header("Content-type: image/png");
> imagepng($img);
> imagedestroy($img);
>

What??? This code is nonsensical!

mystuff() uses imagepng() to output an image to the browser, and has no
return value. Therefore you're effectively calling
imagecreatefromstring(NULL), which just throws warnings. This means that
$img == FALSE, so imagepng() and imagedestroy() fail and throw warnings
as well. Comment out the header() line and you'll see what I mean.

The only reason this appears to work is the combination of mystuff()
outputting (*not* returning) PNG data, coupled with the Content-Type header.


--
Oli

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация