[Newbies] jpg woes
Michael van der Gulik
mikevdg at gmail.com
Tue Jul 21 05:19:03 UTC 2009
On Tue, Jul 21, 2009 at 4:58 PM, Brian Mason <bmason at itassociates.com>wrote:
> I am trying to take an image off the new and save it to a file. This is
> what I have so far:
> (FileStream newFileNamed: 'test.jpg')
> nextPutAll: ('http://freetalklive.com/images/amondson.jpg'
> asUrl retrieveContents) getContentFromStream;
> The image exists, is found, and the file is written. There is something
> wrong with the format of the local jpg.
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
image := 'http://freetalklive.com/images/amondson.jpg' asUrl
f := (FileStream newFileNamed: 'test.jpg').
f nextPutAll: image content.
or for your style of coding:
(FileStream newFileNamed: 'test.jpg') binary;
asUrl retrieveContents) content;
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners