Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]

Loading photo from camera roll
Started by brian0405 Jul 09 2013 04:13 PM

- - - - -
1 reply to this topic
saveload camera roll photo director.lua
This topic has been archived. This means that you cannot reply to this topic.
[TOPIC: post.html]


[GLOBAL: userInfoPane.html]
  • Contributor

  • 136 posts
  • Corona SDK


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.

    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
    local function newphoto ( event )
        if (event.phase == "began") then
            media.show( media.PhotoLibrary, sessionComplete )
            return true
    UploadBar:addEventListener("touch", newphoto)



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!


            local baseDir = system.DocumentsDirectory
            background = display.newImage("photo.jpg",baseDir)
            background.x = _W/2
            background.y = _H/2
            background.xScale = 1
            background.yScale = 1

[TOPIC: post.html]


[GLOBAL: userInfoPane.html]
  • Enthusiast

  • 90 posts
  • Corona SDK

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.




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