[pmwiki-users] php that produces image data

Christian Schlatter ch at schlatter.net
Sat Jul 2 06:33:26 CDT 2005


Joachim Durchholz wrote:
> Chris Cox wrote:
>  > This may be more of an Html question,
> 
> Indeed :-)

or even an HTTP question ;-)

> The other way to do that is to wrap the PHP function as a CGI script in 
> the pub/ directory. You'd then have
>   http://your.server/path/to/pmwiki/pub/script.php?parameter=value
> The PHP can then pick the parameter value from $_REQUEST['parameter']. 
> (Note that you are responsible for doing any access checks from within 
> the script if you want to do it that way.)

and in /pmwiki/pub/script.php you should then set the HTTP headers 
appropriately, e.g.:

<?php

header('Content-type: image/png');
header('Content-Disposition: inline; filename="<PseudoFileName>"');
header('Content-length: <ImageSize>');

... print ImageBytes ....
?>

Then, using

<img src="/pmwiki/pub/script.php?parameter=value" width=".." height=" ..">

should show the image inline in the web page.

ChristianS




More information about the pmwiki-users mailing list