After May 2019 update (version 6.6, check from system admin) it is possible to open a browsing view to mediabank from outside system, where user can manually select assets to be used in this outside system. Purpose of this functionality is to create mechanism, for example to content management system, where user can open a file picker and search image from EMMi Mediabank.

Browsing can be linked either published folder of mediabank root. In the latter case, user has to login in with own credentials or other system can create a session and deliver token.

Implementation:

Embed code
<script type="text/javascript" src="https://static.emmi.fi/EMMiPicker.js"></script>

Trigger the EMMiPicker directly from JavaScript using the following method:
EMMiPicker.choose(options);

Method takes a single options parameter with the following fields:

options = {

    // Required. Called when a user selects an item in the EMMiPicker.
    success: function(files) {
        alert("Here's the file link: " + files[0].downloadurl)
    },

    // Optional. Called when the user closes the dialog without selecting a file
    // and does not include any parameters.
    cancel: function() {

    },

    // Required. EMMi url, can be like:
    // root (https://customer.emmi.fi)
    // public folder link (https://customer.emmi.fi/l/6r5HFJvFhJDN)
    url: "https://customer.emmi.fi",

    // Optional. 
    // downloadurl and filename will be returned only if conversionid is provided.
    conversionid: 1,

    // Optional. A value of false (default) limits selection to a single file, while
    // true enables multiple file selection.
    multiselect: false, // or true

    // Optional. 
    // 
    token: "XntJpxrTd9238nxwqNS5Q7"

};


The files parameter in the above success callback function will be an array of file objects. If multiselect is false, the array will contain a single item. Each file object includes the following fields:

[
    {

        // ID for the asset
        assetid: 1,

        // URL to access the file.
        // Returned only if conversionid is provided
        downloadurl: "https://...",

        // Name of the file.
        // Returned only if conversionid is provided
       filename: "filename.txt"

    }
]


Example of the response:
[{"assetid":8069,"downloadurl":"https://customer.emmi.fi/l/rhpKsaZwhxJr","filename":"IMG_3155.jpg"},{"assetid":8068,"downloadurl":"https://customer.emmi.fi/l/c5Xg9F9J55B9","filename":"IMG_3218.jpg"}]

Feedback

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Post Comment