I’m using the sample code for the camera, and am trying to make the image appear full screen rather than zoomed in to the center after taking the picture. Also I don’t see how the image destination is set and how to
get it for using in email purposes to use as an already attached image. My aim is to have a button to activate the camera and after the image is taken it is saved then below the camera activate button will be a preview button where when click goes to a scene where the image is full screen. Then after this there is then the option to email it. I thought maybe to try scaling the image down using [lua] image:scale (.6, .6) [/lua] but this simply had no effect
This is the sample code…
[lua]
–
– Abstract: Camera sample app
–
– Version: 1.2
–
– Updated: September 21, 2011
–
– Update History:
– v1.1 Fixed logic problem where it said “session was cancelled”.
– v1.2 Added Android support.
–
– Sample code is MIT licensed, see http://www.coronalabs.com/links/code/license
– Copyright © 2011 Corona Labs Inc. All Rights Reserved.]
–
– Supports Graphics 2.0
local centerX = display.contentCenterX
local centerY = display.contentCenterY
local _W = display.contentWidth
local _H = display.contentHeight
– Camera not supported on simulator.
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 bkgd = display.newRect( centerX, centerY, _W, _H )
bkgd:setFillColor( 0.5, 0, 0 )
local text = display.newText( “Tap anywhere to launch Camera”, centerX, centerY, nil, 16 )
local sessionComplete = function(event)
local image = event.target
print( "Camera ", ( image and “returned an image” ) or “session was cancelled” )
print( "event name: " … event.name )
print( "target: " … tostring( image ) )
if image then
– center image on screen
image.x = centerX
image.y = centerY
print( “w,h = “… w …”,” … h )
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
end
bkgd:addEventListener( “tap”, listener )
[/lua]
Thanks again,
Matt.