|
Posted by Oli Filth on 10/08/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
Navigation:
[Reply to this message]
|