Re: [PHP] image commands (again)

2006-11-06 Thread Richard Lynch
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
headtitlerequired by w3c/title/head
body
  pThe text you typed was: ?php echo $_CLEAN['text']?/p
  img src=image_maker.php?text=?php echo
urlencode($_CLEAN['text'])? /
  pThanks 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



[PHP] image commands (again)

2006-11-05 Thread Ron Piggott (PHP)
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




Good morning

{text image}

Good night

---

As soon as I give the 

Content-type: image/

the browser expects only the image to output to the screen and no HTML

Ron


Re: [PHP] image commands (again)

2006-11-05 Thread Google Kreme

On 05 Nov 2006, at 15:31 , Ron Piggott (PHP) wrote:

Content-type: image/

the browser expects only the image to output to the screen and no HTML


As if should.

Save the image in a temporary location and then send html that  
include and img ... / tag



--
Though it's cold and lonely in the deep dark night I can see paradise  
by the dashboard light.


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



Re: [PHP] image commands (again)

2006-11-05 Thread Rasmus Lerdorf
Google Kreme wrote:
 On 05 Nov 2006, at 15:31 , Ron Piggott (PHP) wrote:
 Content-type: image/

 the browser expects only the image to output to the screen and no HTML
 
 As if should.
 
 Save the image in a temporary location and then send html that include
 and img ... / tag

You don't need to do that.  You can just call the PHP script directly
from the img tag.  Your only problem is how to pass the parameters.  You
obviously can't do a POST request from the img tag, so you either need
to pass the parameters as part of the url as in:

  img src=image.php?text=foosize=10 /

Or you use a cookie-based mechanism like a PHP session and refer to that
from the image.php script.

-Rasmus

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