Hi,
Thought i was on the right track with this but am getting an error at the 'CALL security.Base64.FromByte' line below,
saying 'Forms Statement Error -15701 Invalid Parameter'.
Can anyone help plz? Thanks
FUNCTION LIB_CHT_GET_PHOTO() #REMPHOTOS
CONSTANT l_vm_fn = "mypic.tmp"
DEFINE l_md_fn STRING,
l_image BYTE,
l_photos RECORD LIKE photos.*,
b64string STRING
--CALL LIB_CHT_TAKE_PHOTO() RETURNING l_filename
TRY -- This front call may fail if the front-end is not a mobile device:
CALL ui.Interface.frontCall( "mobile", "takePhoto", [], [l_md_fn] )
CATCH
MESSAGE "Cannot take photo: ", STATUS, " ", err_get(STATUS)
LET l_md_fn = NULL
END TRY
IF l_md_fn IS NOT NULL THEN
CALL fgl_getfile(l_md_fn, l_vm_fn)
LOCATE l_image IN FILE l_vm_fn
CALL security.Base64.FromByte(l_image) RETURNING b64string
INITIALIZE l_photos TO NULL
LET l_photos.photo_id = NULL
LET l_photos.filename = l_md_fn
LET l_photos.photo = b64string
LET l_photos.sync = "1"
INSERT INTO photos VALUES l_photos.*
LET l_photos.photo_id = LIB_SYS_GET_ID("photos")
END IF
END FUNCTION