livefeed
Posts: 0
Joined: Tue Jun 18, 2013 11:54 am

How do I retrieve images from a database?

Hi

I have uploaded images to the Files storage. The filename is in a column in the db. But I am not sure how to reference this image name so it loads in my web app.

At the moment I am using the workaround of uploading the image through the Media Manager and using the hard url but would perfer to do it though Files.

Thank you

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

How do I retrieve images from a database?

Hi,

You can see docs here: http://docs.appery.io/documentation/b...

You should remember that such storage requires authorization keys to access data. So you can't use the files directly, such as for app design elements.

Also we have a function Appery.getImagePath (name). Read more here: http://docs.appery.io/javascript-api/...

livefeed
Posts: 0
Joined: Tue Jun 18, 2013 11:54 am

How do I retrieve images from a database?

Hi

I can see the code for retrieving file from your link but I am not sure where to put it, nor how to use an authorization key. Is there a tutorial to follow? I do not want to upload files, only retrieve them.

Thanks

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

How do I retrieve images from a database?

Hi,

I would recommend you to start from doing our tutorials: http://docs.appery.io/tutorials/

Alex Garcia6398098
Posts: 0
Joined: Fri Nov 08, 2013 6:23 pm

How do I retrieve images from a database?

hello! I have the same doubt, I already upload 10 images to the file strorage. Then I want to show them in the start screen of my app...Do you already find the way?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

How do I retrieve images from a database?

Hi Alex,

You can use the following code to access an image stored in database:preAppery("image").attr("src", value)/prewhere 'value' is a base64 string.

Alex Garcia6398098
Posts: 0
Joined: Fri Nov 08, 2013 6:23 pm

How do I retrieve images from a database?

Hi, Katya. I ́m sending you some images of my APP...
I uploaded several images files to Appery database. Then Create a collection with the corresponding names of the images. (I ́m doing this way because I will be adding brands maybe daily).
I ́m following the tutorials and docs, but I cant fix this problem.
The list in the screen changes, but the image is the same for everyone. (I know this because the URL is the name of the image.
What should I do in order to have it fixed??
thanks in advance

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

How do I retrieve images from a database?

Hi Alex,

You read the same file in REST service. That's why it returns the same image.

  1. You should change REST Service so it returns an array. Delete file name from URL and you'll have something like codehttps://api.appery.io/rest/1/db/collections/myCollection/code

  2. Add request parameter "where": http://docs.appery.io/documentation/b...

  3. Map it to list: http://docs.appery.io/documentation/u...

Alex Garcia6398098
Posts: 0
Joined: Fri Nov 08, 2013 6:23 pm

How do I retrieve images from a database?

Ok Katya,,yesterday I read another previous suggestion, and fixed my problem encoding the image to base64, and then adding the code to the collection, and map it to the image asset (icon).
I know that it could slow the app, but because my lack of knowledge, I guess I ́ll stick with this.
Another question, in order to show other screens when clicking in certain button (ie. MET-RX) what should I do to let the program know that the user click this....because when clicking in anyone does the same action...(any of these buttons should show different information).
Thanks in advance =) Image Image

Return to “Issues”