summaryrefslogtreecommitdiff
path: root/www/js/MonitorCtrl.js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js/MonitorCtrl.js')
-rw-r--r--www/js/MonitorCtrl.js70
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);
-
- }
- };
-
}]);