How can I share a display object on facebook or twitter?

So I’m trying to take a screenshot and then share it on facebook. I use the function 

screenCap = display.captureScreen()

which takes an screenshot of the screen but then I want to be able to use this same screenshot and share on facebook. Based on the documentation:

local options = {
service = “facebook”,
message = “Check out this photo!”,
listener = eventListener,
image = {
{ filename = “pic.jpg”, baseDir = system.ResourceDirectory },
{ filename = “pic2.jpg”, baseDir = system.ResourceDirectory }
},
url = "http://coronalabs.com"
}

the image must be a file but i want to be able to use the screenshot I just took (which is a display object) without having to save it into the users photo album. Is there any way around this?

I figured it out. I just use the function

display.save( screenCap, { filename=“screencap.png”, baseDir=system.TemporaryDirectory, isFullResolution=true } )

which saves the image to the temporary directory and I can take the image from there. 

 :)

I figured it out. I just use the function

display.save( screenCap, { filename=“screencap.png”, baseDir=system.TemporaryDirectory, isFullResolution=true } )

which saves the image to the temporary directory and I can take the image from there. 

 :)