Re: image commands (again)

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

 



On Sun, November 5, 2006 4:31 pm, Ron Piggott (PHP) wrote:
> I created a form that I have on my site --- it is at
> http://www.actsministrieschristianevangelism.org/development_tools/textart/details.html
>
> If I run this script it creates a graphic image of the text the user
> typed in with the appropriate options selected
>
> I would now like to have the image created to have some HTML around
> it ... I would like to have some text above the image and following
> it.
> How do I do this in PHP?
>
> I would like something like
.
.
.
> Content-type: image/
>
> the browser expects only the image to output to the screen and no HTML

You can't get it to work because you are not thinking the Right Way :-)

A single HTTP request can return an HTML document, *or* it can return
an IMAGE, but it can't do both. [*]

You *could* do something like this, however:

<?php
  $_CLEAN['text'] = preg_replace('/[[:alnum:]]/', '', $_REQUEST['text']);
?>
<html>
<head><title>required by w3c</title></head>
<body>
  <p>The text you typed was: <?php echo $_CLEAN['text']?></p>
  <img src="image_maker.php?text=<?php echo
urlencode($_CLEAN['text'])?>" />
  <p>Thanks you for using our service.</p>
</body>
</html>

It seems like your existing solution DOES this already.

There's no way to do it as a single HTTP request, though. [*]


[*] Technically, you *can* embed the image data in the HTTP HTML
output stream, but it's very cludgy, doesn't scale well, usually, and
not supported well by all (ancient) browsers.  Don't do that.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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