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

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на 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

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