Re: Include images in php file
| From: | Jochem Maas | Date: | Thu, 28 Jun 2007 13:28:59 +0000 |
| Subject: | Re: Include images in php file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-257911@lists.php.net to get a copy of this message | ||
Marek wrote:
> Hi,
>
> I want to display images with my php script but i want it to be just ONE
> file. I can't have separate image files or folders etc.
>
> I suppose I could get this result by writing a function that generates
> the right image by drawing it from scratch. But that way I can't have
> any photos.
>
> My question: Is there any way to include an entire jpg/gif/png into a
> php file? So that when i call ?pic=myphoto it can present the right
> photo without a database or additional files. Like a serialized form of
> an image or something that can be copied, saved in a text editor and
> later reassembled as a proper photo.
yes. well done for taking the time to search:
http://dean.edwards.name/weblog/2005/06/base64-sexy/
http://www.greywyvern.com/code/php/binary2base64
http://php.net/base64_encode <-- 4th comment
>
> Thanks for your help.
> Marek
>