<br><br><div class="gmail_quote">On Tue, Jul 21, 2009 at 4:58 PM, Brian Mason <span dir="ltr"><<a href="mailto:bmason@itassociates.com">bmason@itassociates.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="purple" lang="EN-US">
<div>
<p>Greetings,</p>
<p> </p>
<p>I am trying to take an image off the new and save it to a
file. This is what I have so far:</p>
<p> </p>
<p>(FileStream newFileNamed: 'test.jpg')</p>
<p> nextPutAll:
('<a href="http://freetalklive.com/images/amondson.jpg" target="_blank">http://freetalklive.com/images/amondson.jpg</a>' asUrl retrieveContents)
getContentFromStream;</p>
<p> close</p>
<p> </p>
<p>The image exists, is found, and the file is written.
There is something wrong with the format of the local jpg. <br></p></div></div></blockquote></div><br clear="all">Your stream needs to be "binary". Don't ask me more than about this; I only discovered it through trial, error and reading the code for HTTPSocket>>httpJpeg:<br>
<br>image := '<a href="http://freetalklive.com/images/amondson.jpg">http://freetalklive.com/images/amondson.jpg</a>' asUrl retrieveContents.<br>f := (FileStream newFileNamed: 'test.jpg').<br>
f binary.<br>f nextPutAll: image content.<br>f close.<br><br>or for your style of coding: <br>
<p>(FileStream newFileNamed: 'test.jpg') binary;<br></p><p> nextPutAll:
('<a href="http://freetalklive.com/images/amondson.jpg" target="_blank">http://freetalklive.com/images/amondson.jpg</a>' asUrl retrieveContents) content;</p>
<p> close.</p>
<br><br>Gulik.<br><br>-- <br><a href="http://gulik.pbwiki.com/">http://gulik.pbwiki.com/</a><br>