Kenny Lee
Posts: 0
Joined: Wed Mar 04, 2015 11:35 pm

How to display an image from the database in the list component when it's saved as a string?

I followed your online tutorial: http://devcenter.appery.io/tutorials/...

What I created was a "Take Photo" button, an image component to preview the image, a text input field to add a name to the photo, and a "Save" button.

Everything appears to be working when I test on my device. I can take a photo with the take photo button, I can preview it in the image component and it shows up, I can enter text in the text input component, and when I hit the save button it saves everything to the database. ( I checked the db and it is saving properly)

In my database, the image is saved as a series of numbers, since the type is set to string, for example: "1425515368083."

I created a separate list on a separate page with a label and an image component inside. I created a list service for the page, and I am able to map the text from the name in the database to the label in my list. It is not allowing me to map the Photo from the database to the "Asset" for my image component. The only area it allows me to map the Photo from the DB to is the mobilelistitem.

What am I doing wrong?
Image

Egor Kotov6832188
Posts: 0
Joined: Wed Nov 19, 2014 5:15 pm

How to display an image from the database in the list component when it's saved as a string?

Hello Kenny.

Unfortunately, your approach will not work.
You need to remove Photo column with String type and create new Photo column with File type.
Try to create test data and check mapping and result

Kenny Lee
Posts: 0
Joined: Wed Mar 04, 2015 11:35 pm

How to display an image from the database in the list component when it's saved as a string?

I tried that too but I have only "file name" and "original file name" to map the local storage variable to. (On my create, before send service mapping) should I map to file name?

Egor Kotov6832188
Posts: 0
Joined: Wed Nov 19, 2014 5:15 pm

How to display an image from the database in the list component when it's saved as a string?

Hello Kenny.
You get it all wrong.

List_service1 is working with some collection, right ? It is not the File collection.
That is why we suggested you to delete Photo column, cause it has wrong type. Right now it's type is String, but is should be File.
Go to your DB, open that collection:
1) delete Photo column
2) create Photo column, but this time choose File type instead of String

Kenny Lee
Posts: 0
Joined: Wed Mar 04, 2015 11:35 pm

How to display an image from the database in the list component when it's saved as a string?

I used the new Cordova camera plugin and it works great. The old tutorial said to save images as Strings which had me confused. The new plugin helped a lot. Thanks!

Return to “Issues”