display.save not working

Just tested the following code

-- capturing the photo local selfie = display.captureBounds( border.contentBounds ) selfie.x = display.contentCenterX selfie.y = display.contentCenterY display.save(selfie, "selfie.jpg", system.CachesDirectory)

the image is never saved. Tried using system.CachesDirectory, system.TemporaryDirectory and system.DocumentsDirectory.

Running locally on a Mac.

Corona Version 2014.2289 (2014.4.30)

Hi Try this

local myObject1 = display.newRect( 50, 50, 50, 50 )

myObject1:setFillColor(1,0,0)

local selfie = display.captureBounds( myObject1.contentBounds )

selfie.x = display.contentCenterX

selfie.y = display.contentCenterY

            

display.save(selfie, “selfie.jpg”, system.CachesDirectory)

It will work for you.

Regards,

S P Technolab

Hi.

My border is a image object, so it would behave as your newRect. Did you try your solution?

Just to be sure, we are talking here about HTML5 build.

Below code work fine for me and save selfie.jpg in  system.CachesDirectory

local myObject1 = display.newImageRect( “Icon.png”, 50, 50 )

myObject1.x = 200

myObject1.y = 200

local selfie = display.captureBounds( myObject1.contentBounds )

selfie.x = display.contentCenterX

selfie.y = display.contentCenterY

            

display.save(selfie, “selfie.jpg”, system.CachesDirectory)

local combined = display.capture( selfie, { saveToPhotoLibrary=false})

combined:removeSelf()

selfie:removeSelf()

selfie = nil

Best Regards,

Team, SP Technolab

www.sptechnolab.com

Finally had the time to test it again.  It is still not working (daily build 2014.2329).  Tried saving the image to Caches, Temporary and DocumentsDirectory and nothing.

I run the code below and get savedImage = nil.

Another possibility is that the display.newImage (with file not from ResourcesDirectory) that is not working. Since I don’t know where is the Caches, Temporary, DocumentsDirectory of a HTML5 app, I cannot say who is broken (display.save or display.newImage). 

Tested with this simple code: Show image on screen, saved it and show it again.

local image = display.newImage("a.jpg") image.x = display.contentCenterX image.y = display.contentCenterY timer.performWithDelay(2000, function() display.save(image, "test.jpg", system.TemporaryDirectory) timer.performWithDelay(2000, function() local savedImage = display.newImage("test.jpg", system.TemporaryDirectory) print("savedImage=", savedImage) end) end)

Hi Try this

local myObject1 = display.newRect( 50, 50, 50, 50 )

myObject1:setFillColor(1,0,0)

local selfie = display.captureBounds( myObject1.contentBounds )

selfie.x = display.contentCenterX

selfie.y = display.contentCenterY

            

display.save(selfie, “selfie.jpg”, system.CachesDirectory)

It will work for you.

Regards,

S P Technolab

Hi.

My border is a image object, so it would behave as your newRect. Did you try your solution?

Just to be sure, we are talking here about HTML5 build.

Below code work fine for me and save selfie.jpg in  system.CachesDirectory

local myObject1 = display.newImageRect( “Icon.png”, 50, 50 )

myObject1.x = 200

myObject1.y = 200

local selfie = display.captureBounds( myObject1.contentBounds )

selfie.x = display.contentCenterX

selfie.y = display.contentCenterY

            

display.save(selfie, “selfie.jpg”, system.CachesDirectory)

local combined = display.capture( selfie, { saveToPhotoLibrary=false})

combined:removeSelf()

selfie:removeSelf()

selfie = nil

Best Regards,

Team, SP Technolab

www.sptechnolab.com

Finally had the time to test it again.  It is still not working (daily build 2014.2329).  Tried saving the image to Caches, Temporary and DocumentsDirectory and nothing.

I run the code below and get savedImage = nil.

Another possibility is that the display.newImage (with file not from ResourcesDirectory) that is not working. Since I don’t know where is the Caches, Temporary, DocumentsDirectory of a HTML5 app, I cannot say who is broken (display.save or display.newImage). 

Tested with this simple code: Show image on screen, saved it and show it again.

local image = display.newImage("a.jpg") image.x = display.contentCenterX image.y = display.contentCenterY timer.performWithDelay(2000, function() display.save(image, "test.jpg", system.TemporaryDirectory) timer.performWithDelay(2000, function() local savedImage = display.newImage("test.jpg", system.TemporaryDirectory) print("savedImage=", savedImage) end) end)