Page 1 of 2

A simple way to display image from DB, Media Manager

Posted: Mon Feb 15, 2016 8:41 am
by skarun

I have an image UI component on my page. Can I not just insert a ng-src = {{item.filename}} and get an image displayed.

I have a field in the DB / collection called "file" and I can add another field "filename", but what is the right way to refer to the file.

Any other easy ways?

Thanks!


A simple way to display image from DB, Media Manager

Posted: Mon Feb 15, 2016 9:23 am
by Serhii Kulibaba

Hello,

Sure, it is possible. Please use links to that images, like:
$scope.item.filename = "files/images/fileName.jpg";

here fileName.jpg = name of the image from Media Manager


A simple way to display image from DB, Media Manager

Posted: Mon Feb 15, 2016 11:03 am
by skarun

I have put ng-src = {{pic.ImageName}}

And in init after invoking the service, I have this code
function(success) {
$scope.pic = success.data;
var fname = "files/images/"+$scope.pic.ImageName;
alert(fname);
$scope.pic.ImageName=fname;
},

The alert correctly displays the filename. But the image does not display.

On Rt-click - "Open image in new tab", I get Page not found.
http://appery.io/app/view/079deec2-22...

Thanks for your above response, and hope to hear from you.


A simple way to display image from DB, Media Manager

Posted: Mon Feb 15, 2016 12:14 pm
by Serhii Kulibaba

Please set your app public (https://devcenter.appery.io/documenta...)


A simple way to display image from DB, Media Manager

Posted: Mon Feb 15, 2016 12:16 pm
by skarun

Done


A simple way to display image from DB, Media Manager

Posted: Mon Feb 15, 2016 12:18 pm
by skarun

If it is possible to answer in this same question, I would also like to know

  1. if the image can be made clickable
  2. and on click, if it can be opened using the default image viewer of the system (android, ios, ..)

A simple way to display image from DB, Media Manager

Posted: Mon Feb 15, 2016 12:33 pm
by Serhii Kulibaba

Are you sure this image is exist in the Media Manager? Could you send us screen shot with it?

You can open an image in new tab to display it in the image viewer, e.g.: http://community.phonegap.com/nitobi/...


A simple way to display image from DB, Media Manager

Posted: Mon Feb 15, 2016 12:49 pm
by skarun

you are brilliant - accidentally i had deleted that image, now it works. sorry about that.

Opening in system viewer - doesn't seem to work - would you be please able to check.

Thanks!


A simple way to display image from DB, Media Manager

Posted: Mon Feb 15, 2016 3:03 pm
by Serhii Kulibaba

Please try several 3rd-part plugins, for that, e.g.:
https://github.com/andischerer/cordov...
https://github.com/keensoft/FullScree...

More information, how to install pluging: https://devcenter.appery.io/documenta...


A simple way to display image from DB, Media Manager

Posted: Sat Feb 20, 2016 11:31 am
by skarun

As per documentation at https://devcenter.appery.io/documenta..., in section "Direct link to a file", its described that I can access the Files by using a URL in this format -
https://api.appery.io/rest/1/db/files...=

I was able to access the file
https://api.appery.io/rest/56bedd67e4...

I got the the filename from the Predefined collections - Files - File name field.

userSessionToken and masterKey is optional.

Just some additional information if it helps anyone.