Getting image url from binary data

Getting image url from binary data

  

(Outsystems Mobile application)

Hi All,

         I am trying to get url from a binary data which is an image that is saved in a local database. Can someone suggest me javascript code or any other methods to get the url.

Thanks in advance.

Hello Ragul,

I am not understanding...
If the image is saved in the database, there is no "url" for it. 

Why do you need a URL for an image in local storage?
What are you trying to accomplish?

Cheers.

Solution

Hi ragul sp,

if the image is stored on local storage (on the device), the URL will likely have to be a "data:" url. Check here for an explanation of what these URLs are. You will build them by starting the URL with data:image/<format>;base64, and then appending the contents of the image (after converting the binary content to base64 you can find this functionality in the BinaryData platform extension).

If it's in a server database, you can define a screen that receives as input parameter the ID for the image, and in the Preparation fetches it from the database and ends in a Download tool. Your image's URL will be the URL for your screen plus the input parameter thats tells it which image to provide.

Solution

Eduardo Jauch wrote:

Hello Ragul,

I am not understanding...
If the image is saved in the database, there is no "url" for it. 

Why do you need a URL for an image in local storage?
What are you trying to accomplish?

Cheers.


Hi Eduardo,

                   As a challenge task I am trying to frame a url with the help of some javascript for the image saved in the local db. And I am also testing whether the framed url is working in the download file action from file transfer plugin.

Thank you

Jorge Martins wrote:

Hi ragul sp,

if the image is stored on local storage (on the device), the URL will likely have to be a "data:" url. Check here for an explanation of what these URLs are. You will build them by starting the URL with data:image/<format>;base64, and then appending the contents of the image (after converting the binary content to base64 you can find this functionality in the BinaryData platform extension).

If it's in a server database, you can define a screen that receives as input parameter the ID for the image, and in the Preparation fetches it from the database and ends in a Download tool. Your image's URL will be the URL for your screen plus the input parameter thats tells it which image to provide.

Hi Jorge,

              Thank you so much. I think i found an answer for my question and that's of great help.


Hi Ragul,

Challenge as in learning how to do? In this case, Jorge's answer is the way to go.

But you see, there is no way to a access directly, through URL, a database object. At least you will need some middle layer that will get the object.

So, in order to receive a faster answer (and possibly suggestions of better ways of dping something), It's always better to explain what you're trying to accomplish, instead of just asking how to do something :)

Cheers and good studies.

Eduardo Jauch wrote:

Hi Ragul,

Challenge as in learning how to do? In this case, Jorge's answer is the way to go.

But you see, there is no way to a access directly, through URL, a database object. At least you will need some middle layer that will get the object.

So, in order to receive a faster answer (and possibly suggestions of better ways of dping something), It's always better to explain what you're trying to accomplish, instead of just asking how to do something :)

Cheers and good studies.

Hi Eduardo,

                   Yeah I am learning to implement different concepts in Outsystems. Thank you for making the answer even more clear and whenever I have a need to ask questions again, I will implement what you said. Thanks for letting me know your suggestion to the way of asking questions.