Re: Image Rendering/Generation Options

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

 



Dan Trainor wrote:
I've seen a few times, albeit I don't know how, people generate images on a page in different ways, such as maybe using base64 to output the raw image data into a page? Is this correct?

If so, what does it "look" like?  How would one go about doing this?

If not, what are my options to achieve something like this? What are my alternatives? What kind of performance impact, if any, does this make on both the load on the server and the rendering time for a given image to the client? Last but certainly not least, is this a dumb idea?

What I'm looking to do is to deliver dynamic content to the browser, without writing images to disk. I simply want what would be written to disk, be displayed in a specific area I'm talking about.

I'm sorry if this is a dumb question. Once I get a few more clues here, I'll be able to figure the rest of this out pretty well, I'm quite sure.

To output it directly on the page (with base64 or otherwise), you need to make use of the data: URI scheme [1]. This is, unfortunately, not supported by (you guessed it) MSIE, although I believe Gecko-based browsers have support. Not sure about Opera.

However, the usual way to go about this is to do something like:

<img src="/some_script.php?some_var=some_value" alt="some alt text">

in the HTML, and then in some_script.php put the following code:

header('Content-Type: image/jpeg'); //or whatever image type

and use GD functions [2] to create and output the image.

HTH

Jasper

[1] http://www.faqs.org/rfcs/rfc2396.html
[2] http://www.php.net/gd

--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

If you find my advice useful, please consider donating to a poor
student! You can choose whatever amount you think my advice was
worth to you. http://tinyurl.com/7oa5s

--
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