Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>i've got trouble too with using IE6 and OFC2 for saving image... So here are the scripts i use (javascript + PHP)</p> <p>i know it's not very beautifull but jQuery doesn't want to work in a popup created via <strong><em>window.open('')</em></strong> on my IE6 so i decided to use a "old school method" to get it...</p> <pre><code>// javascript in the page displaying the flash chart OFC = {}; OFC.jquery = { name: "jQuery", image: function(src) { return '&lt;img src="data:image/png;base64,' + $('#'+src)[0].get_img_binary() + '" \/&gt;'}, popup: function(src) { var img_tag = OFC.jquery.image(src); var img_win = window.open('', 'imagesave'); img_win.document.write('&lt;html&gt;&lt;head&gt;&lt;title&gt;imagesave&lt;\/title&gt;&lt;\/head&gt;&lt;body&gt;'+ img_tag + '&lt;\/body&gt;&lt;\/html&gt;'); img_win.document.close(); }, popupie: function(src) { var img_data = "image/png;base64,"+$("#"+src)[0].get_img_binary(); var img_win = window.open('', 'imagesave'); with(img_win.document) { write('&lt;html&gt;'); write('&lt;head&gt;'); write('&lt;title&gt;imagesave&lt;\/title&gt;'); write('&lt;\/head&gt;'); write('&lt;body onload="document.forms[0].submit()"&gt;'); write('&lt;form action="\/ofc\/base64post.php" method="post"&gt;'); write('&lt;input type="hidden" name="d" id="data" value="'+img_data+'" \/&gt;'); write('&lt;\/form&gt;'); write('&lt;div&gt;&lt;img src="\/ofc\/ajax-loader.gif" border="0" alt="" \/&gt;&lt;\/div&gt;'); write('&lt;div style="font-family: Verdana;"&gt;Please wait&lt;br \/&gt;After you can save the image&lt;\/div&gt;'); write('&lt;\/body&gt;'); write('&lt;\/html&gt;'); } img_win.document.close(); } } function save_image() { // this function is automatically called if ($.browser.msie) OFC.jquery.popupie("my_chart"); // only for IE navigators else OFC.jquery.popup("my_chart"); // for the others } </code></pre> <p>so, when we use the <strong><em>save_image()</em></strong> function (which is automaticaly called when you right clic dans select "Save Image Locally" on the flahs chart) the image of the chart is tranfered to the popup and the data (base64 binary image) are posted to a php script <strong><em>/ofc/base64post.php</em></strong> that rander the picture :</p> <pre><code>&lt;?php // base64post.php $data = split(';', $_POST['d']); $type = $data[0]; $data64 = split(',', $data[1]); $pic = base64_decode($data64[1]); header("Content-type: $type"); echo $pic; ?&gt; </code></pre> <p>hope that help someone !</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload