Getting Image from Rollbase to display on Rollbase Mobile

Posted by KelvinDude on 24-Nov-2014 04:49

Apologies if this has been asked before - I can't seem to find anything asking this.

I have a RollbaseApp that stores an image - how do I get that image and display it in a RollbaseMobile app?  I had hoped that it would be easy - but I can't seem to get it going.  The JSDO service gives me the file name only.

All Replies

Posted by Sanjeva Manchala on 24-Nov-2014 05:01

Hi Kelvin,

Similar question is asked in forum long time back, but I don't have the exact link to that question. The answer is you have to convert the image into base64 string and then read that data. Here is the link on how to convert an image into base 64 format:

stackoverflow.com/.../how-to-get-image-bytes-string-base64-in-html5-jquery-javascript

Hope this helps,

Sanjeev.

Posted by Xavier Bonnamy on 24-Nov-2014 09:14

Hi Kelvin

If you have use and image upload field, you may try to create a new formula field in example and populate it with your image_upload_field_#url (see component tokens suffix section in the documentation). Using this field in RB Mobile to do the mapping with your image asset should work.

Hope this helps,

Xavier

Posted by KelvinDude on 25-Nov-2014 04:03

Hi Xavier,

Good to speak to you again.

I used the image_upload_field#url and I get a url; but when I use that URL - either in the browser or in the RollbaseMobile app - I get an empty page.

The url returned is something like this:  www.rollbase.com/.../Image

I notice that there is no session id or anything similar in the url - is there a step that I am missing somewhere?

Posted by Xavier Bonnamy on 25-Nov-2014 09:06

Hi Kelvin,

This is bizarre

I did a test with a formula field  for which the formula is : return "{!file#url}"; (file is the image upload field I created). The field value is formed like this www.rollbase.com/.../Image id>&fileName=<another id>.png&contentType=image%2Fpng

When mapping that to the image asset in the Rollbase Mobile Appbuilder I am getting the image properly displayed.

Hope this helps.

Xavier

This thread is closed