<html><body bgcolor="#FFFFFF"><div>I don't have access to a smalltalk image right now, but my guess is you need to strip the string of the mine type declaration first. The php example does the same thing: it takes the substring after the comma before decoding and writing to the file.<br><br>--<div>Johan</div></div><div><br>On 27 Jul 2011, at 17:43, "Bob N." &lt;<a href="mailto:bobn@rogers.com">bobn@rogers.com</a>&gt; wrote:<br><br></div><div></div><blockquote type="cite"><div>Thanks. Here is what I'm now using...&nbsp;<div><br></div><div><div><div>html jQuery ajax&nbsp;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>callback: [:value |&nbsp;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>| writestream | <span class="Apple-tab-span" style="white-space:pre">                        </span></div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>writestream := (('c:\data\sketchpad_', Time now asSeconds printString ,'.png') asFilename withEncoding: &nbsp;#binary) writeStream.</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>[writestream nextPutAll: (Seaside.GRPlatform current base64Decode: value) asByteArray] ensure: [writestream close]]&nbsp;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>value: (Javascript.JSStream on: 'sketchpadCanvas.toDataURL()')</div></div><div><br></div><div>...but I got an exception in&nbsp;Net.MimeScanner class&gt;&gt;decodeBase64From:to:in:on:&nbsp;</div>
<div><br></div><div>aString size is 17074 and the code iterates over the string, checking a #limit which is set to the string size. But the code checks for index + 3 which exceeds the string size. &nbsp;Hacking the code so the limit is set to size - 3 works, but the resulting image is not a valid PNG file.</div>
<div><br></div><div>Is there is way to test the decoded content to see if it is a valid PNG file?</div><div><br></div><div>I also tried toDataURL("image/jpeg")&nbsp;which created an output starting with 'data:image/jpeg;base64' but that also saved an invalid image file.</div>
<div><br></div><div>Bob&nbsp;</div><br><div class="gmail_quote">On Wed, Jul 27, 2011 at 10:23 AM, Philippe Marschall <span dir="ltr">&lt;<a href="mailto:philippe.marschall@gmail.com"><a href="mailto:philippe.marschall@gmail.com">philippe.marschall@gmail.com</a></a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">2011/7/27 Bob N. &lt;<a href="mailto:bobn@rogers.com"><a href="mailto:bobn@rogers.com">bobn@rogers.com</a></a>&gt;:<br>
<div class="im">&gt; Thanks Johan, feels like I almost have it.<br>
&gt; I'm doing this work in VW.&nbsp;Could someone show the VW equivalent of<br>
&gt; #base64Decoded? Or is it in some Seaside compatibility library? I'm using<br>
&gt; 'Seaside 3.0 - 87' from the Cincom public repository.<br>
<br>
</div>GRPlatform current base64Decode:<br>
<br>
Cheers<br>
<font color="#888888">Philippe<br>
</font><div><div></div><div class="h5">_______________________________________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org"><a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a></a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank"><a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a></a><br>
</div></div></blockquote></div><br></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>seaside mailing list</span><br><span><a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a></span><br><span><a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a></span><br></div></blockquote></body></html>