Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: 1 ... 7 8 [9] 10
 81 
 on: October 22, 2024, 08:24:00 am 
Started by Richard M. - Last post by Sebastien F.

Note that when running on mobile, you can directly display the opaque filename returned by the takePhoto or choosePhoto front call.

Warning: you must remove UNBUFFERED mode in the main.4gl sample, otherwise the BYTE variable automatic display will take place.

Code
  1.        ON ACTION take_photo_disp
  2.           CALL ui.Interface.frontCall("mobile","takePhoto",[],filename)
  3.           IF filename IS NOT NULL THEN
  4.              INITIALIZE rec.* TO NULL
  5.              LET rec.name = filename
  6.              DISPLAY filename TO photo
  7.           END IF

But that opaque filename is only valid during the lifetime of the app instance.

If you want to store the images in the local database to keep it persistent, you have to store the BYTE data (or the TEXT in base64, if there is any good read for that)

Seb

 82 
 on: October 21, 2024, 04:28:35 pm 
Started by Richard M. - Last post by Sebastien F.

Attached a sample using takePhoto / choosePhoto front calls and displaying the photo.

If someone has a better way to do this for mobile apps, suggestions are welcome.

Seb

 83 
 on: October 21, 2024, 03:12:01 pm 
Started by Christine R. - Last post by Christine R.

 FourJs License Manager  6.00 -  Maintenance Release
Maintenance Release


Four Js is pleased to announce a Maintenance Release of Four Js License Manager and License Controller 6.00.22.

What's new ...
A new package for macOS ARM is now available. The Operating System code is m64a1200.
m64a1200 and m64x1200 packages are now tested on macOS 15.x.

These versions are now downloadable from the Four Js web site : https://4js.com/download/products/.

All Four Js Genero customers under maintenance have access to the new release.

Best regards,

Four Js Development Tools

 84 
 on: October 21, 2024, 08:21:54 am 
Started by Richard M. - Last post by Sebastien F.
Hello Richard,

Can you please provide the context (Genero version, Front-ends type and version, DB servers type and version, OSes type and version, etc) - We can better help if we know the context and such "details".

I was wondering why you need to convert the image data to base64.
I assume this is to send the images as plain text to the server?

About using IMPORT security:

While security.Base64.FromByte() needs the BYTE to be located in memory, DISPLAY BY NAME needs the BYTE to be located in a file:
https://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_images_dynamic_images.html
Section "Displaying images contained in BYTE variables"

Since Genero BDL 2.51, we have util.Strings methods to encode/decode in base64.

https://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_ext_util_Strings_methods.html

Except if you really need other APIs of the "security" module in your mobile app, I would just use the "util" package.

How to you plan to upload the photos to the central database?
Using RESTful Web Services?

What is the SQL CREATE TABLE DDL for the local mobile l_photos table and its equivalent on the server side to store photos?

Seb

 85 
 on: October 20, 2024, 02:35:14 am 
Started by Richard M. - Last post by Reuben B.
Re your error with security.base64.FromByte, note the Important tip in the documentation https://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_gws_SecurityBase64_FromByte.html

 86 
 on: October 19, 2024, 11:46:09 pm 
Started by Richard M. - Last post by Richard M.
Plus you need to;

IMPORT security

 87 
 on: October 19, 2024, 11:42:24 pm 
Started by Richard M. - Last post by Richard M.
The below code now works.


-----------------------------;

FUNCTION LIB_CHT_GET_PHOTO(l_drop_id)                      #REMPHOTOS

CONSTANT l_vm_fn = "mypic.png"
DEFINE l_drop_id    INTEGER

DEFINE l_md_fn     STRING,
       l_image,
       l_byte      BYTE,
       l_photos    RECORD LIKE photos.*,
       b64string   STRING,
       l_text      TEXT

    --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)
        CALL security.Base64.LoadBinary(l_vm_fn) RETURNING b64string
 
        LOCATE l_text IN MEMORY
        LET l_text = b64string
       
        INITIALIZE l_photos TO NULL

        LET l_photos.photo_id   = NULL
        LET l_photos.drop_id    = l_drop_id
        LET l_photos.filename   = l_md_fn
        LET l_photos.photo      = l_text
        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

 88 
 on: October 17, 2024, 05:42:48 pm 
Started by Richard M. - Last post by Richard M.
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


 89 
 on: October 17, 2024, 11:53:42 am 
Started by Benjamin G. - Last post by Benjamin G.
Hello,

When using WSAttachement to send a file to a GET request, how do I specify that the file is optional?
If I specify an existing file everything works fine. If I don't give a file (ficdia = NULL) it generates an infinite loop with code -8 (http error ...)


this is how the service is defined ...

PUBLIC FUNCTION getDownloadCustomerDiapo(head_numpro STRING ATTRIBUTES(WSHeader,WSOptional,WSName = ‘X-NUMPRODIS’)
                                        ,head_numcli STRING ATTRIBUTES(WSHeader,WSOptional,WSName = ‘X-NUMCLI’)
                                        ,head_diacli STRING ATTRIBUTES(WSHeader,WSOptional,WSName = ‘X-DIACLI’))
         ATTRIBUTES(WSGet
                   ,WSPath = ‘/download-customer-diapo’
                   ,WSDescription = ‘GET : Retrieves the zip file with the customer's slideshows’ ,WSRetCode = ‘GET : Retrieves the zip file with the customer's slideshows
                   ,WSRetCode = ‘201:Ok’
                   ,WSThrows = ‘400:Bad Request,500:Internal Server Error’)
        RETURNS (STRING ATTRIBUTES(WSMedia = ‘application/json’)
                ,STRING ATTRIBUTES(WSAttachment, WSMedia = ‘zip/*’))
  DEFINE jsn base.StringBuffer
  DEFINE ficdia STRING

  LET ficdia = prodisdbs.getDownloadCustomerDiapoPRODIS(jsn:=base.StringBuffer.create(),head_numpro,head_numcli,head_diacli)

  RETURN jsn.toString(),ficdia
END FUNCTION

thank you


 90 
 on: October 15, 2024, 04:13:13 pm 
Started by Roland W. - Last post by Reuben B.
Roland,

Have a read of https://4js.com/ask-reuben/ig-89/ for a discussion on UNBUFFERED.  Note the point "What you may also find is that you add fields to the dialog statement even though they are NOENTRY". 

A typical scenario is you have

Title (Label).     Code. (ButtonEdit).   Description (Label)

you might add the Description field to the INPUT statement so that any change in value of Description is reflected in the front-end without an explicit DISPLAY being required

Reuben

Pages: 1 ... 7 8 [9] 10
Powered by SMF 1.1.21 | SMF © 2015, Simple Machines