Re: image commands (again)

From: Date: Mon, 06 Nov 2006 21:21:34 +0000
Subject: Re: image commands (again)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-244276@lists.php.net to get a copy of this message
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!ô.Ï#¼èd > Õp˜î > > 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?

« previous php.general (#244276) next »