[Phpwm] displaying images on screen

Tim Williams T.M.Williams at cs.bham.ac.uk
Thu Oct 2 14:42:20 UTC 2008


On Thu, 2 Oct 2008, Alex Mace wrote:

> I think in that situation you'll need to save it out to a file and
> write an <img /> tag into the html to access it - I don't think there
> is a way to output the picture as binary in the middle of some html.
> If you don't want to save it out, just set the "src" attrobute of the
> img to something like
>
> rotateimage.php?filename=YOURFILENAME

You need to make sure to use a unique file name for every saved image if 
you do this, otherwise you end up with some interesting problems if you 
have more than one person at a time on the website. However, that's a 
potentially messy solution unless you have some reason to want to cache 
the images generated on the server.

The trick is to split up the processing between two PHP pages, one 
generates the HTML page, that HTML page then contains an <img> tag which 
links to a second PHP script which generates the image. You could either 
use sessions or get parameteres embedded in the image URL to transfer the 
necessary data between the two php scripts.

Tim W

-- 
Tim Williams BSc MSc MBCS - Euromotor Autotrain
Web : http://www.autotrain.org
Tel : +44 (0)121 414 2214 (ext 42214 on internal phone)



More information about the Phpwm mailing list