About Base64Convertor with TableViewer

Hi all,

My scenario is: I have a tableviewer that I use to populate a SQLite table and in each record has two images. So, I write the record this way:

And when I have to edit a record in tableviewer I do this:

And the result is none of images appear in edition. So, I was taking a look into this block:

And I am trying to understand if I have to put a completed filepath in the filePath or it could be with another way...

My goal is to insert images into a tableviewer, but instead of showing the filepath, I need to show image, but when I have to edit, I need to have its filepath in order to update with another picture and so on. After all of this, I send to a MySQL remote server (this step is ok already).

Just to be more clear: I am doing this, to indicate the path where images are stored:

And when I get images to insert into tableviewer, I do this:


(post deleted by author)

approximately 2/3 of the way down the list blocks pallette.

You might have to read them.

The base64 extension accepts an absolute filepath, what this is will depend on where the image is that you want to convert, but for example if the image is in your Download folder, then the filepath would be:

/storage/emulated/0/Download/yourimage.png

You can use the file component to construct filepaths for the ASD or Assets, just remember to remove the file:// from the beginning of the path.

Some advice:

  • store your images as datauris, that is, add the data:image/png;base64, before the base64String. You can then easily view the image in a webviwer. You can always remove the datauri prefix if required.

  • do not try to view the base64 String in a textbox or label, this can fail and crash your app

Got it.

Whe you say this, means when I am editing image or seeing in tableviewer?

I misread your blocks:

image

but this will not display an image, correct, because you store that field as a base64String ?

Yes, that's right. Here is the point I don't know what to do to see the images... That's why I asked about this block:

As I said, create a datauri, then view the image in a webviewer instead of an image component, then you do not have to create a file.

1 Like

Ok, I will try it. Thanks again

datauri means? Can you explain with blocks?

If you don't mind can you share the blocks as well (or .aia file), So I also can learn it.

Have you lost the power of search ?

2 Likes