diff options
| author | PliablePixels <pliablepixels@gmail.com> | 2015-07-16 11:23:38 -0400 |
|---|---|---|
| committer | PliablePixels <pliablepixels@gmail.com> | 2015-07-16 11:23:38 -0400 |
| commit | 61afc8d7011f8a741b2583708ac1834e8eec44c2 (patch) | |
| tree | 436d709de6ba9e9ffd845a83c01c45ee342e8ad1 /www/js/MonitorCtrl.js | |
| parent | 82a0ec7a39ec49fb028876368014600a665f253c (diff) | |
moved saveImageToPhone to Modal - it was not working because button range was out of scope of modal controller range.
Diffstat (limited to 'www/js/MonitorCtrl.js')
| -rw-r--r-- | www/js/MonitorCtrl.js | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/www/js/MonitorCtrl.js b/www/js/MonitorCtrl.js index 3307c800..5725a690 100644 --- a/www/js/MonitorCtrl.js +++ b/www/js/MonitorCtrl.js @@ -353,76 +353,6 @@ angular.module('zmApp.controllers').controller('zmApp.MonitorCtrl', ['$ionicPopu }; - function SaveSuccess() { - $ionicLoading.show({ - template: "done!", - noBackdrop: true, - duration: 1000 - }); - console.log("***SUCCESS"); - } - - - function SaveError(e) { - $ionicLoading.show({ - template: "error - could not save", - noBackdrop: true, - duration: 2000 - }); - ZMDataModel.zmLog("Error saving image: " + e.message); - console.log("***ERROR"); - } - - //----------------------------------------------------------------------- - // Saves a snapshot of the monitor image to phone storage - //----------------------------------------------------------------------- - - //http://stackoverflow.com/questions/11618266/save-a-web-photo-to-camera-roll-in-phonegap - $scope.saveImageToPhone = function (mid) { - $ionicLoading.show({ - template: "saving snapshot..", - noBackdrop: true, - duration: zm.httpTimeout - }); - - console.log("IMAGE CAPTURE"); - var canvas, context, imageDataUrl, imageData; - var loginData = ZMDataModel.getLogin(); - var url = loginData.streamingurl + - '/cgi-bin/zms?mode=single&monitor=' + $rootScope.tempmid + - '&user=' + loginData.username + - '&pass=' + loginData.password; - ZMDataModel.zmLog("SavetoPhone:Trying to save image from " + url); - - var img = new Image(); - img.onload = function () { - canvas = document.createElement('canvas'); - canvas.width = img.width; - canvas.height = img.height; - context = canvas.getContext('2d'); - context.drawImage(img, 0, 0); - try { - imageDataUrl = canvas.toDataURL('image/jpeg', 1.0); - imageData = imageDataUrl.replace(/data:image\/jpeg;base64,/, ''); - cordova.exec( - SaveSuccess, - SaveError, - 'Canvas2ImagePlugin', - 'saveImageDataToLibrary', [imageData] - ); - } catch (e) { - - SaveError(e.message); - } - }; - try { - img.src = url; - } catch (e) { - SaveError(e.message); - - } - }; - }]); |
