Many thanks to Rolf Huehne and Bob Hanson for their tips on this question.
As a follow up and for completeness, in case someone looks for it later,
here's the full answer in code:
*HTML file and Javascript (client side)*
<html>
<head>
<script type="text/javascript">
function get_snapshot()
{
var BI = document.getElementById("bounce_image");
var BI_D = document.getElementById("IMAGE_DATA");
var BASE64 = jmolGetPropertyAsString("image");
BI_D.value = BASE64;
BI.submit();
}
</script>
</head>
<body>
<script type="text/javascript">
jmolInitialize("jmol/");
jmolApplet(350,"load something.pdb");
</script>
<input class="jmol_snapshot" type="button" id="snapshot" value="snapshot"
onclick='get_snapshot()'>
<form id="bounce_image" action="
http://MY.SERVER.COM/cgi-bin/decode_snapshot.pl" method="post"
target="_blank">
<input type="hidden" id="IDB_ID" name="IDB_ID" value="some
id">
<input type="hidden" id="IMAGE_WIDTH" name="IMAGE_WIDTH"
value="350">
<input type="hidden" id="IMAGE_HEIGHT" name="IMAGE_HEIGHT"
value="350">
<input type="hidden" id="IMAGE_DATA" name="IMAGE_DATA"
value="empty">
</form>
</body>
</html>
*PERL script (server side) file 'decode_snapshot.pl'*
#!/usr/bin/perl
use MIME::Base64;
print "Content-type: text/html\n\n";
%postFields = ();
read( STDIN, $tmpStr, $ENV{ "CONTENT_LENGTH" } );
@parts = split( /\&/, $tmpStr );
foreach (@parts) {
s/%([0-9A-F][0-9A-F])/pack("c",hex($1))/ge;
( $name, $value ) = split(/\=/);
$postFields{ "$name" } = $value;
}
$decoded = decode_base64($postFields{"IMAGE_DATA"});
open (MYFILE, '>path_to_file/jmol_snapshot.jpg');
print MYFILE $decoded;
close (MYFILE);
print "<img src='path_to_file/jmol_snapshot.jpg' />";
exit;
This should work in all browsers.
PS Codes can be further optimized, I guess, but the way they are written now
makes it pretty clear how they work...
--
0 | Mauricio Carrillo Tripp, PhD
/ | Department of Molecular Biology, TPC6
0 | The Scripps Research Institute
\ | 10550 North Torrey Pines Road
0 | La Jolla, California 92037
/ | [EMAIL PROTECTED]
0 | http://www.scripps.edu/~trippm
** Aut tace aut loquere meliora silentio **
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users