Screen Capture to Email

I need a little help, I would like to capture the current screen image using either

local screenCap = display.captureScreen( true )
or
local baseDir = system.DocumentsDirectory
display.save( g, “display.jpg”, baseDir )

And then use something like
local options =
{
isBodyHtml = true,
img src = “display.jpg”
}

native.showPopup(“mail”, options)

to display the image in the body of the Email.

NOTE:
I realize that I’m missing the < and > around img src = “display.jpg” If I put them there, then the tag takes over and you can’t see my code.

Any help or other ideas would be greatly appreciated!!
Thanks,
Brandon

[import]uid: 18460 topic_id: 30528 reply_id: 330528[/import]

[lua] local options =
{
isBodyHtml = true,
img src = “display.jpg”
}[/lua]
It will search for image in ResourceDirectory. It is wrong becuase you saved the image in Documents directory. [import]uid: 138389 topic_id: 30528 reply_id: 122321[/import]

Here’s the code I used for my app. Basically, after my game is complete I present a certificate of completion with the player’s name on it. This code will capture the screen, then open an email message and attach the screenshot to the email:

[code]
local baseDir = system.DocumentsDirectory
display.save( layer1, “certificate.png”, baseDir ) – does a screen capture of all objects on layer1

local options =
{
subject = “My Certificate of Completion”,
body = “I wanted to show you my certificate!\n\nFrom,\n\n”,
attachment = {baseDir=system.DocumentsDirectory, filename=“certificate.png”, type= “image”},
}
local showPopupNow = native.showPopup(“mail”, options)

– In case the device is not setup with an email application, this alert shows up:
if showPopupNow == false then
native.showAlert( “Error”, “Please setup the email application on your device first and then try again.”, { “OK” } )
end
[/code] [import]uid: 82194 topic_id: 30528 reply_id: 122322[/import]

Thanks for both of your help! I will give it a try!

Brandon [import]uid: 18460 topic_id: 30528 reply_id: 122376[/import]

[lua] local options =
{
isBodyHtml = true,
img src = “display.jpg”
}[/lua]
It will search for image in ResourceDirectory. It is wrong becuase you saved the image in Documents directory. [import]uid: 138389 topic_id: 30528 reply_id: 122321[/import]

Here’s the code I used for my app. Basically, after my game is complete I present a certificate of completion with the player’s name on it. This code will capture the screen, then open an email message and attach the screenshot to the email:

[code]
local baseDir = system.DocumentsDirectory
display.save( layer1, “certificate.png”, baseDir ) – does a screen capture of all objects on layer1

local options =
{
subject = “My Certificate of Completion”,
body = “I wanted to show you my certificate!\n\nFrom,\n\n”,
attachment = {baseDir=system.DocumentsDirectory, filename=“certificate.png”, type= “image”},
}
local showPopupNow = native.showPopup(“mail”, options)

– In case the device is not setup with an email application, this alert shows up:
if showPopupNow == false then
native.showAlert( “Error”, “Please setup the email application on your device first and then try again.”, { “OK” } )
end
[/code] [import]uid: 82194 topic_id: 30528 reply_id: 122322[/import]

Thanks for both of your help! I will give it a try!

Brandon [import]uid: 18460 topic_id: 30528 reply_id: 122376[/import]

I’m wondering if there is a way to have the image opened in the body of the Email? Would anyone have a solution to this? Outlook in particular will not open the image.

I tried opening is using HTML but I get a compiler error when trying to open an image.

 local baseDir = system.DocumentsDirectory  
 display.save(screenCap, "displayScreen.png", baseDir)  
  
 local options =  
 {  
 to = { "" },  
 cc = { "" },  
 subject = "Check out this attachment",  
 isBodyHtml = true,  
 body = " ![](displayScreen.png)",  
 }  
 native.showPopup("mail", options)  

I’ve tried the Documents Directory and the Resource Directory with no success.

Thanks in advance for your help!
Brandon [import]uid: 18460 topic_id: 30528 reply_id: 123215[/import]

I’m wondering if there is a way to have the image opened in the body of the Email? Would anyone have a solution to this? Outlook in particular will not open the image.

I tried opening is using HTML but I get a compiler error when trying to open an image.

 local baseDir = system.DocumentsDirectory  
 display.save(screenCap, "displayScreen.png", baseDir)  
  
 local options =  
 {  
 to = { "" },  
 cc = { "" },  
 subject = "Check out this attachment",  
 isBodyHtml = true,  
 body = " ![](displayScreen.png)",  
 }  
 native.showPopup("mail", options)  

I’ve tried the Documents Directory and the Resource Directory with no success.

Thanks in advance for your help!
Brandon [import]uid: 18460 topic_id: 30528 reply_id: 123215[/import]