scale a taken photo to screen size

I can take a photo using this code :

local centerX = display.contentCenterX local centerY = display.contentCenterY local isXcodeSimulator = "iPhone Simulator" == system.getInfo("model") if (isXcodeSimulator) then local alert = native.showAlert( "Information", "Camera API not available on iOS Simulator.", { "OK"}) end local sessionComplete = function(event) local image = event.target if image then image.x = centerX image.y = centerY local w = image.width local h = image.height end end local listener = function( event ) if media.hasSource( media.Camera ) then media.capturePhoto( { listener = sessionComplete } ) else native.showAlert("Corona", "Camera not found.") end return true endtrigger:addEventListener( "tap", listener )

But if the picture is to big it doesn’t zoom out or scale down, i have tried  local w =display.contentWidth  but nothing’s happening. How can i scale the photo to the exact screen size, probably need to scale in the Y axis to fill the screen

Solved the problem by using this equation

image.contentWidth / image.contentHeight * display.contentHeight

local sessionComplete = function(event) local image = event.target if image then imgWidth = image.contentWidth / image.contentHeight \* display.contentHeight image.x = centerX image.y = centerY image.width = imgWidth image.height = display.contentHeight end end

got it to work but : 

4rRZdlY.jpg

Solved the problem by using this equation

image.contentWidth / image.contentHeight * display.contentHeight

local sessionComplete = function(event) local image = event.target if image then imgWidth = image.contentWidth / image.contentHeight \* display.contentHeight image.x = centerX image.y = centerY image.width = imgWidth image.height = display.contentHeight end end

got it to work but : 

4rRZdlY.jpg