by
Allistar Melville >> Sun, 19 Oct 2003 21:47:57 GMT
Hi again,
JHP has been extended to allow any type of data to be returned from the JADE database. It used to allow returning of HTML only, but now you can output images that come straight from the JADE database, or pdf files, zip files, etc. These files can come either from the database or can be automaticalky generated by your Jade code (it doesn't really matter as all you are returning to the browser - through JHP - is binary data).
This has been made possible by allowing HTTP headers to be added and modified, and in this case you would modify the content-type header to be image/jpeg etc.
A small example that outputs an image from Jade is:
<?jhp
vars
file: File;begin
create file transient;
file.fileName := "c:\somefile.jhp";
file.kind := file.Kind_Binary;
echo(file.readBinary(file.fileLength()).String);
addHTTPHeader("Content-Type", "image/jpeg");
epilog
delete file;
end;
?>
This example gets an image off the disk by JADE, but it could have easily returned a binary from an object in the JADE database as well.
This could also be used to easily allow .pdf files to be returned to the browser from the JADE database. This is also secure in the sense that you didn't want a file stored on the webserver anywhere, and using this they aren't.
I hope this helps,
Allistar.
------------------------------------------------------------------
Allistar Melville
Software Developer, Analyst
allistar@silvermoon.co.nz
Auckland, NEW ZEALAND
Silvermoon Software
Specialising in JADE development and consulting
Visit us at:
http://www.silvermoon.co.nz
*NEW* Simple web access to Jade at:
www.silvermoon.co.nz/jhp.html ------------------------------------------------------------------