Page 1 of 1

Using Images for a collection

Posted: Thu Jun 19, 2014 4:50 pm
by Carlos Castillo6909856

Im about to start an app that will use a collection with images, unfortunately all your seminars only uses text examples, or do you have any tutorial that handles images from appery local DB?


Using Images for a collection

Posted: Thu Jun 19, 2014 6:16 pm
by Kateryna Grynko

Hi Carlos,

Here is how to do it:
http://sqlite.1065341.n5.nabble.com/s...

I'd recommend that you store images as files and retrieve them this way:
http://stackoverflow.com/questions/21...


Using Images for a collection

Posted: Thu Jun 19, 2014 6:38 pm
by Carlos Castillo6909856

Thank you Katya for the quick respond but,

I want to use appery.io DB not an external sql

I find the Files under Predefined collections

I presume I do have to load the images there

And at the collections I do have a new column called images and declared as object

But what do I need to load into the collection cell declared; the id from "Files" or the actual image file?

If I just paste the identifier from the File DB
I recive this message
Incorrect JSON object value: c1193e51-6484-4541-be72-b825e5517afe.Fondo.png

And also what kind of images can I use? jpg, tiff, png, gif ...


Using Images for a collection

Posted: Fri Jun 20, 2014 2:29 am
by Yurii Orishchuk

Hi Carlos.

There is no "_id" column in system "Files" collection.

Please use following solution:

  1. Add to your custom collection field "file" with type "string".

  2. Upload file to the system "Files" collection.

  3. Get "File Name" field and insert it in "file" field from your custom collection(that's you need to link this file).

  4. Open your custom collection mapping and link "file" field to image.asset and click "Add JS" on this mapping. Fill it with following code:

    http://prntscr.com/3ula5f/direct

    http://prntscr.com/3ulabg/direct

    pre

    return "https://appery.io/bksrv/rest/1/admin/files/download/52fd3d06e4b0a25c11c89917/" + value;

    /pre

    That's all.

    Regards.