Re: Include images in php file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Marek wrote:
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.

Why not? This seems like a rather daft limitation.

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.

You could base64_encode the image data and stick it in a string. However, by doing this you will be causing huge memory usage whenever teh script is used because PHP will allocate the memory required for each embedded image even when you are only going to use one.

Put simply, it's a rediculous way to approach the problem. I suggest you explain why there is this restriction - there may be a better way to do it.

-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux