1. Marc James
  2. PowerServer Mobile (Obsolete)
  3. Wednesday, 13 November 2019 16:46 PM UTC

Hiya there!

My first time posting here, am hoping someone can point me in the right direction smile

I have a live mobile application running which is successfully deployed online. It has been developed in the latest PB2019 Build 2082. I am running it through 4G on my mobile phone, but I am struggling when it comes to taking photos. I've attached the appeon_workarounds.pbl and use it to create my eon_appeon_resize statements to make everything look the right size, this has worked really well. I declare my eon_appeon_resize ieon_resize in the global variables and create the ieon_resize = create eon_appeon_resize. Then when I open any new window, the resizing can be called easily.

But I am not sure how I make a new window that shows what the camera is showing? I'd then like a button to capture that live image, then resize it a bit and send it to the wwwroot folder on the server into a particular folder with a specific name.

I've been following Fili Sosa's https://www.youtube.com/watch?v=41JdieCvog8 youtube video, but he doesn't go into enough detail for me at the 55min 40sec area.

So as a summary I'd like to:

  1. Know which global variables to define & which objects to create
  2. Know what I must use to display the current image from the phone/tablets rear camera
  3. Know what the button script must contain to capture an image and send it to wwwroot/folder

 

Many thanks and king regards

Accepted Answer
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 13 November 2019 21:16 PM UTC
  2. PowerServer Mobile (Obsolete)
  3. # Permalink

Hi Marc;

   Here is the code that I use in my Mobile App for interacting with the camera ...

eon_mobile_str_cameraoption        lstr_camera
Integer        li_file_type  =  0    // Photo Only
Integer        li_rc

IF  rb_photo.checked = TRUE  THEN
    lstr_camera.i_filetype        =    1
else
    lstr_camera.i_filetype        =    2
END IF
lstr_camera.b_allowedit = cbx_edit.checked
li_rc    =    io_camera.of_takefile ( lstr_camera , sle_cam_file.text )
st_cam_rc.text  = st_cam_rc.tag  + String (li_rc)
IF  li_rc    = 1 THEN
    pc_photo.picturename = sle_cam_file.text
else
    pc_photo.picturename = ""
END IF

HTH

Regards ... Chris

Comment
  1. Marc James
  2. Thursday, 14 November 2019 10:10 AM UTC
Thanks Chris, just getting a bit stuck on io_camera.takefile, getting the following error

"Warning C0014: Undefined variable: io_camera"



What i've done so far

● Declared the eon_mobile_str_cameraoption lstr_camera in my global variables of the project

● Added the integer variables into open statement of my window

● Inserted a photo named it p_photo

● Inserted check box called cbx_edit

● Inserted single line edit called sle_cam_file

● Inserted to window open statement lstr_camera.i_filetype = 1

● Inserted to window open statement lstr_camera.b_allowedit = cbx_edit.checked

● Inserted to window open statement li_rc = io_camera.of_takefile ( lstr_camera , sle_cam_file.text )



Then that is when I get the Undefined variable. Do I need to add a non-visual object?

Apologies - still a bit of a PB amateur here :)
  1. Helpful
  1. Chris Pollach @Appeon
  2. Thursday, 14 November 2019 16:53 PM UTC
Hi Marc;

The "io" prefix naming convention I use stands for "Instance of an Object". Here is my code for that ...



Instance Declaration:

eon_mobile_cameraex io_camera



Open or Constructor Event:

io_camera = CREATE eon_mobile_cameraex // Instantiate camera helper!



Regards ... Chris

  1. Helpful
  1. Marc James
  2. Friday, 15 November 2019 17:58 PM UTC
See code below that worked for me in the end
  1. Helpful
There are no comments made yet.
Marc James Accepted Answer Pending Moderation
  1. Friday, 15 November 2019 17:57 PM UTC
  2. PowerServer Mobile (Obsolete)
  3. # 1

Thanks, I have been trying to get the image from camera into a picture box.

So if you create a picture box, with a button to take a photo, then insert this code below into your button, it should do the trick, you will also need to create some instance variables for the window you're working in which I will also show below.

MY TAKE IMAGE BUTTON CODE

string ls_filepath="", ls_newfile=""
boolean ib_edit_photo
integer lstr_is_photo

lstr_option.i_filetype = 1
lstr_option.b_allowedit = true
leon_camera = create eon_mobile_cameraex
leon_camera.of_takefile( lstr_option,ls_filepath )

is_photo1 = ls_filepath

leon_image = create eon_mobile_imageex
ls_newfile = ls_filepath
leon_str_image.l_width = 125
leon_str_image.l_height = 150
leon_str_image.b_existoverwrite = true
leon_str_image.i_imagetype = 0
leon_str_image.i_quality = 9
leon_image.of_createimagewithoptions( ls_filepath, ls_newfile, leon_str_image, leon_str_info )

p_photo1.picturename = ls_newfile

destroy leon_camera
destroy leon_image

MY INSTANCE VARIABLES FOR THE WINDOW WITH THE BUTTON IN

eon_mobile_cameraex leon_camera
eon_mobile_str_cameraoption lstr_option
eon_mobile_imageex leon_image
eon_mobile_str_imageoption leon_str_image
eon_mobile_str_imageinfo leon_str_info
Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.