iOS Grab Image from Library and Email as Attachment?

Thomas McGrath III mcgrath3 at mac.com
Tue Feb 14 08:43:41 EST 2012


John,

Have you used the templateImage? Also, I use type image/png and not image/jpg. This code works for me on iPad1 and iPhone:
...
   doStartActivityIndicator
    set the width of the templateImage to 200
    set the height of the templateImage to 200
    set the lockLoc of the templateImage to true
    set the name of the templateImage to "test"
    mobilePickPhoto "Library"
   put the text of image "test" into tAttachment["data"]
   put "image/png" into tAttachment["type"]
   put "MinSticker" into tAttachment["name"]
   doStopActivityIndicator
   mobileComposeMail "It Works!!!",,,,"This is my Picture", tAttachment		
 -- delete image "test"
…

-- Tom McGrath III
http://lazyriver.on-rev.com
3mcgrath at comcast.net

On Feb 14, 2012, at 12:23 AM, John Patten wrote:

> Hi All..
> 
> I'm attempting to send an email message with an attachment of the last image added to the card via the mobilePickPhoto call. I don't have the attachment call correct.  I'm using the following:
> 
> on mouseUp
> 
>   if iphoneCanSendMail () is true then
>      put the text of field "subject" into tSubject
>      put the text of field "toField" into tTo
>      put the text of fld "body" into tBody
>      put "" into tCCs
>      put "" into tBCCs
> 
> -- I'm using the mobilePickPhoto to add an image to the card from the library.
> 
>  put the name of the last img into gvAttachment["name"]
>      put "image/jpeg" into gvAttachment["type"]
>      put the text of  last img into gvAttachment["data"]
> 
>      mobileComposeMail field "subject", field "toField", , , field "body", gvAttachment
>      answer the result with "OK"
>   else
>      answer "Your device cannot be used to send email." with "OK"
>   end if
> 
> end mouseUp
> 
> Any advice on how to add the image attachment?
> 
> Thank you!
> 
> John Patten
> SUSD
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list