skarun
Posts: 0
Joined: Fri Sep 18, 2015 2:23 am

A simple way to display image from DB, Media Manager

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!

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

A simple way to display image from DB, Media Manager

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

skarun
Posts: 0
Joined: Fri Sep 18, 2015 2:23 am

A simple way to display image from DB, Media Manager

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.

skarun
Posts: 0
Joined: Fri Sep 18, 2015 2:23 am

A simple way to display image from DB, Media Manager

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, ..)
Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

A simple way to display image from DB, Media Manager

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/...

skarun
Posts: 0
Joined: Fri Sep 18, 2015 2:23 am

A simple way to display image from DB, Media Manager

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!

skarun
Posts: 0
Joined: Fri Sep 18, 2015 2:23 am

A simple way to display image from DB, Media Manager

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.

Return to “Issues”