How to program the media browser in Magento 2

- Magento 2

Magento 2 Development

Being a jQuery UI widget Magento 2 media browser provides administrators with the ability to use a media library. Thus, they can easily  upload images to media library and choose images from it.

'

The widget is called $.mage.mediabrowser. Besides, there is a global utility object named MediabrowserUtility used for opening and closing media browser (openDialog and closeDialog methods). Both are defined in the lib/web/mage/adminhtml/browser.js AMD module loadable via the mage/adminhtml/browser name. Use the following code to open the media browser in Magento 2:

Source

More tips from the Cookbook

'