Loading photo from camera roll

Hello, 

Hopefully someone can help me with my problem!! :blink:

I’ll try to explain this as fully as possible, with code!

So what i am doing in the following code is that i am loading a photo from camera roll in the function newphoto. After complete it is going to the function sessionComplete. In sessionComplete the image is displayed on the screen and also saves the photo.

[lua]

    local function sessionComplete ( event )

       t = event.target

       local baseDir = system.DocumentsDirectory

       display.save(t, “photo.jpg”, baseDir)

       t.x = _W/2

       t.y = _H/2

       t.xScale = .25

       t.yScale = .25

    end

    

    

    local function newphoto ( event )

        if (event.phase == “began”) then

            media.show( media.PhotoLibrary, sessionComplete )

            return true

        end

    end

    

    UploadBar:addEventListener(“touch”, newphoto)

[/lua]

Now in a different lua document. i try to display the image. The problem now is that the same photo is disproportional. I tried everything that i could think of… any help PLEASE!

[lua]

            local baseDir = system.DocumentsDirectory

            background = display.newImage(“photo.jpg”,baseDir)

            background:setReferencePoint(display.CenterReferencePoint);

            background.x = _W/2

            background.y = _H/2

            background.xScale = 1

            background.yScale = 1

[/lua]

i was trying your code and i found something strange. The “photo.jpg” file that you save from the photo library it’s not in the real resolution. I found that when i tried to send that photo as an email attachment. 

In the following link it says :

NOTE: When dynamic content scaling is enabled, display.save()
saves the image in the device’s native resolution. For instance, if
this method is used to save a 100 x 200 pixel display object, it will be
saved as a 100 x 200 image on iPhone3 but it will be a 200 x 400 image
on an iPhone4 (which would have the same content dimensions but more
actual pixels). This is assuming that the config.lua file specifies the content width/height as 320x480 respectively.

http://docs.coronalabs.com/api/library/display/save.html

Do you have any idea how to get the image on it’s real resolution?

i was trying your code and i found something strange. The “photo.jpg” file that you save from the photo library it’s not in the real resolution. I found that when i tried to send that photo as an email attachment. 

In the following link it says :

NOTE: When dynamic content scaling is enabled, display.save()
saves the image in the device’s native resolution. For instance, if
this method is used to save a 100 x 200 pixel display object, it will be
saved as a 100 x 200 image on iPhone3 but it will be a 200 x 400 image
on an iPhone4 (which would have the same content dimensions but more
actual pixels). This is assuming that the config.lua file specifies the content width/height as 320x480 respectively.

http://docs.coronalabs.com/api/library/display/save.html

Do you have any idea how to get the image on it’s real resolution?