|
Posted by Oli Filth on 01/03/06 22:33
Darkbyte [Work] said the following on 03/01/2006 19:57:
> Hi everybody!!!
> I have a script (foo.php) which uses GD to create an image and sends it
> to the browser:
>
> <?php
> $img = imagecreatefrompng("mypng.png");
>
> /* other stuff */
>
> header("Content-type: image/png");
> imagepng($img);
>
> imagedestroy($img);
> ?>
>
> I also have another php script: goofy.php.
> How can I use imagecreatefrompng to load the result of foo.php (without
> saving it on the hard disk first)?
>
> I tried with: imagecreatefrompng("foo.php") but doesn't work...
> Can anyone help me, please?
Well, you could do it with the absolute HTTP URL, i.e.:
imagcreatefrompng("http://example.com/blah/foo.php");
(assuming allow_url_fopen is enabled).
However, doing a complete HTTP transaction just to get an image from
yourself is overkill.
A more sensible, programmatic way of doing this is to put the
image-creation stuff from foo.php into a function in an include() file,
and then call it from foo.php and goofy.php.
--
Oli
[Back to original message]
|