Reading OSX mail attachments

Tim Ponn alptex2 at orwell.net
Mon Mar 12 11:12:40 EDT 2007


Ken,

Yes, I do have the image in my rev stack set to the same as the  
original jpeg image..in this case 350 x 232.

For what it's worth, once I isolate (theAttachment), I also put  
base64Decode(theAttachment) into a field.  I then opened the original  
Pool Table.jpg with a text editor.  They look identical and they are  
the same length...well...the jpg file has 3 extra bytes, but I would  
attribute this to eof.

Because the slice of hash is about 1/16 the width of the image that I  
end up with (the balance being black), is it possible that  
base64Decode is actually hex, and not binary?  Maybe coincidence?

On Mar 12, 2007, at 10:51 AM, Ken Ray wrote:

> 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/
>

Best Regards,

Timothy R. Ponn






More information about the use-livecode mailing list