[pmwiki-users] php that produces image data
Patrick R. Michaud
pmichaud at pobox.com
Sat Jul 2 10:44:44 CDT 2005
On Fri, Jul 01, 2005 at 11:44:11PM -0500, Chris Cox wrote:
> I have a php function that produced raw image data... for example, png
> data. Is there a way to embed that into something... even using
> markup?? I know about <img src="blah.png" .... anyway to display
> a data stream??
1. As a separate script:
<?php
header("Content-type: image/png");
RawImageData();
In markup you would call this as
http://server/path/to/script.php?d=.png
to get PmWiki to display it as an inline image. The "d=.png"
is a dummy parameter to get PmWiki to treat the url as an inline image.
Of course, you can define a custom markup shortcut to generate the
full url.
2. As a function in PmWiki:
$HandleActions['raw.png'] = 'HandleRawImage';
function HandleRawImage($pagename) {
header("Content-type: image/png");
RawImageData();
exit();
}
In markup you would call this as http://server/pmwiki.php?action=raw.png .
Since the url already ends in ".png" PmWiki would automatically inlie it.
There are probably other ways to do it, but these are the most
straightforward.
Pm
More information about the pmwiki-users
mailing list