How to save the picture to the album when the mui picture is previewed

mui How to save the picture to the album

mui when previewing the picture, you need to save the picture to the album.

实现效果图:

实现思想

1.Change the mui.previewimage.js source

Set the save button and time, get the current preview image url

@ Preview Image = Function(options) {
This.options = $.extend(true, {
Id: '__MUI_PREVIEWIMAGE',
Zoom: true,
Header: '<span class="mui-preview-indicator"></span><div onclick="saveImage()" class="down">Save</div>',
Footer: ''
}, options || {});
This.init();
this.initEvent();
};
proto._loadItem = function(index, isOpening) { //TODO temporarily only supports img
// alert(index);
Var itemEl = this.scroller.querySelector($.classSelector('.slider-item:nth-child(' + (index + 1) + ')'));
Var itemData = this.currentGroup[index];
Var imgEl = itemEl.querySelector('img');
// alert(imgEl.src);
currentPreviewSrc=imgEl.src;

2, set the click event for saving the album

function saveImage(e){

Var btnArray = ['cancel', 'save'];
Mui.confirm('Do you want to save the picture?', 'Save image to album', btnArray, function(e) {
                    If (e.index == 1) {
                    Plus.gallery.save(currentPreviewSrc, function() {
Mui.toast('save success');
}, function() {
Mui.toast('Save failed, please try again!');
});
                    } else {
// //Exit the app
// mui.currentWebview.close();
                    }
        })

}