Page 1 of 1

Show Image from database.

Posted: Mon Jan 13, 2014 3:56 am
by Robert Larsen

Ok I need to pull an image from my database. But here is the deal I call a server not my database, the server response tells which image file name should be shown. The API Provider provides a folder of all the images which I have downloaded and uploaded into my database. And the image can always vary based on a certain attribute (EX. different ranks have different images, so when you call the server with your information it pulls your current rank, stats ect..) Basically the service response tells me the name of the image file I need to display. So how do I map this? Or let the service decide or use java what image to pull from the database? Image Imageinline.png?1389585230[/img] [/url]


Show Image from database.

Posted: Mon Jan 13, 2014 5:24 am
by Alena Prykhodko

Hello Robert,

Please show us screnshots of Service settings and mapping (Request and Response tabs).
Have you checked this doc http://docs.appery.io/documentation/b...?


Show Image from database.

Posted: Sat Jan 25, 2014 8:13 am
by Robert Larsen

I have not begun to map yet not quite sure on how to do it. I uploaded those photos directly into the files data in my appery database. I did however try to create a database service for file and when I viewed mapping for response there was no tabs to map. Is it ok to upload them directly into Files Data? Or should I be putting them into a new collection and if so how?


Show Image from database.

Posted: Mon Jan 27, 2014 9:33 am
by Maryna Brodina

Hello! If we understand correctly in response you have bf4/ranks/r2.png and using this response you're going to show image from Appery.io DB with r2.png name. In this case you need to use Direct link to file http://docs.appery.io/documentation/b...
1) You need to match name returned in response with real name in DB. Real name is in File Name column in Files collection (on your second screenshot). Create JS asset where you define global variable. For example prevar imagesInDb = {
"bf4/ranks/r2.png": "b65ae1e1-fa62-4b7d-8ee7-45005a57345b.r2.png",
"bf4/ranks/r3.png": "e8cfdf90-ef7f-e3bc-92da-d49f75d72b10.r3.png",
"some/other/b13.png": "e8cfdf90-ef7f-41bc-92da-d49f75d72b10.b13.png"
}/pre2) map from imgLarge parameter to image asset and add the following code in mapping prereturn "https://api.appery.io/rest/1/db/files/xxxxxxxxxxxxxxxxx/" + value;/prewhere xxxxxxxxxxxxxxxxx - DB id.