Reading OSX mail attachments

Ken Ray kray at sonsothunder.com
Mon Mar 12 10:51:35 EDT 2007


On Mon, 12 Mar 2007 10:15:59 -0400, Tim Ponn wrote:

> Hello,
> 
> Thanks for your help, but I'm still having problems displaying the 
> image correctly.  This snippet from the .eml file says it's base 64:
> 
> --FTG_BOUNDRY
> Content-Type: image/jpeg; name="Pool Table.jpg"
> Content-disposition: attachment
> Content-transfer-encoding: base64
> 
> But, when I open the file within rev...strip out all the text ahead 
> of the attachment...strip out all the junk past the end of the 
> attachment...then set the image data of an image to 
> base64Decode(theattachment)...I get mostly a black image with a 
> sliver of hash on the left side.
> 
> I have got to be missing something basic here!

Do you know ahead of time the size of the image? Because before you set 
the imageData of an image, you need to have the rect of the image be 
correct otherwise you'll get garbage. I would suggest pumping the 
base64Decode(theattachment) to a binary file called "Pool Table.jpg" 
and then importing that image from disk (or set the filename of an 
empty image to the file path).

Just my 2 cents,

Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/



More information about the use-livecode mailing list