Page 1 of 2
How do I retrieve images from a database?
Posted: Thu Jul 04, 2013 2:52 pm
by livefeed
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
How do I retrieve images from a database?
Posted: Thu Jul 04, 2013 4:16 pm
by Kateryna Grynko
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/...
How do I retrieve images from a database?
Posted: Thu Jul 04, 2013 4:34 pm
by livefeed
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
How do I retrieve images from a database?
Posted: Thu Jul 04, 2013 7:23 pm
by Kateryna Grynko
Hi,
I would recommend you to start from doing our tutorials: http://docs.appery.io/tutorials/
How do I retrieve images from a database?
Posted: Fri Nov 08, 2013 6:23 pm
by Alex Garcia6398098
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?
How do I retrieve images from a database?
Posted: Fri Nov 08, 2013 7:01 pm
by Kateryna Grynko
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.
How do I retrieve images from a database?
Posted: Sun Nov 10, 2013 2:21 am
by Alex Garcia6398098
How do I retrieve images from a database?
Posted: Sun Nov 10, 2013 2:29 am
by Alex Garcia6398098
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
How do I retrieve images from a database?
Posted: Mon Nov 11, 2013 8:15 am
by Kateryna Grynko
Hi Alex,
You read the same file in REST service. That's why it returns the same image.
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
Add request parameter "where": http://docs.appery.io/documentation/b...
Map it to list: http://docs.appery.io/documentation/u...
How do I retrieve images from a database?
Posted: Mon Nov 11, 2013 7:14 pm
by Alex Garcia6398098
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 =)