Get image from mobile camera

Visuals, audio, animation. Blended, not stirred. If LiveCode is part of your rich media production toolbox, this is the forum for you.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
classic12
Posts: 7
Joined: Wed Jan 04, 2012 4:34 pm

Get image from mobile camera

Post by classic12 » Wed Jan 04, 2012 6:59 pm

I have tried:

on mouseUp
## This is the only way to name an imge BEFORE it is created
set the name of the templateimage to "harry"
mobilePickPhoto "front camera" ,100 , 100
if the result <> empty then
--put the result into image "image1"
put "harry" into image "image1"
EXIT mouseup
end if

## Succes, now you can use the new image

end mouseUp

Whichever out method I use the image is not shown in image1 it is in the centre of the stack.

Also if I run the stack within livecode I get an error on line ' mobilePickPhoto "front camera" ,100 , 100 '
stating
Line 4 (Handler: can't find handler) near "mobilePickPhoto", char 1

Cheers

SteveW

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7237
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Get image from mobile camera

Post by jacque » Thu Jan 05, 2012 6:55 am

The image is created automatically, so you don't need to "put" it anywhere. It will always be in the middle of the stack unless you set the location of the templateImage beforehand, just like you set the name. Any property you need for the created image must be set in the template first.

So, you need to:

Code: Select all

set the name of the templateimage to "harry"
set the loc of the templateimage to 10,10 -- or wherever you want it
mobilePickPhoto "front camera" ,100 , 100
if the result = "" then -- did not error
  -- do something with image "harry" here
end if
All the "mobile" commands will only work in mobile devices, they are not supported on the desktop. That is why you are getting an error. You need to separate the command depending on the environment that is currently running:

Code: Select all

if the environment = "mobile" then
  set the name of the templateimage to "harry"
  set the loc of the templateimage to 10,10 -- or wherever you want it
  mobilePickPhoto "front camera" ,100 , 100
  if the result = "" then -- did not error
    -- do something with image "harry" here
  end if
end if
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

classic12
Posts: 7
Joined: Wed Jan 04, 2012 4:34 pm

Re: Get image from mobile camera

Post by classic12 » Thu Jan 05, 2012 5:32 pm

Got that thanks.

I cannot get the camera to fire up in 2 different android 2.2 devices (phone & tablet) .

If I use:
mobileCameraFeatures
put the result into field "details4"
I get :

rear
photo
Although the tablet has a front camera.

This works on Iphone
set the name of the templateimage to "harry"
set the loc of the templateimage to 100,100
mobilePickPhoto "camera", 100,100

Post Reply

Return to “Multimedia”