From 3cf45d915d514e5b21d1e77d403f91cdf9c9cf21 Mon Sep 17 00:00:00 2001 From: arnaucode Date: Wed, 21 Jun 2017 20:06:29 +0200 Subject: [PATCH] upload image avatar works now --- config.xml | 88 +++++++++++++++++++++++----------------------- www/js/app.js | 3 +- www/js/editUser.js | 15 ++++++-- www/js/travel.js | 4 +-- 4 files changed, 60 insertions(+), 50 deletions(-) diff --git a/config.xml b/config.xml index e9b8b0f..6db05d1 100644 --- a/config.xml +++ b/config.xml @@ -1,49 +1,49 @@ - + - CarsInCommon - + CarsInCommon + CarSharing app, for collective use. - + ArnauCode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/js/app.js b/www/js/app.js index ee4db43..31ab112 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -6,7 +6,8 @@ // 'starter.controllers' is found in controllers.js -var urlapi = "http://localhost:3000/api/"; +//var urlapi = "http://localhost:3000/api/"; +var urlapi = "http://192.168.1.36:3000/api/"; //var urlapi = "http://51.255.193.106:3000/api/"; angular.module('starter', [ diff --git a/www/js/editUser.js b/www/js/editUser.js index adfc88e..6ee6947 100644 --- a/www/js/editUser.js +++ b/www/js/editUser.js @@ -11,19 +11,27 @@ angular.module('app.editUser', ['pascalprecht.translate']) destinationType: Camera.DestinationType.DATA_URL, sourceType: Camera.sourceType, allowEdit: true, - encodingType: Camera.EncodingType.JPEG, - targetWidth: 100, - targetHeight: 100, + encodingType: Camera.EncodingType.PNG, + targetWidth: 500, + targetHeight: 500, popoverOptions: CameraPopoverOptions, saveToPhotoAlbum: false, correctOrientation:true }; $cordovaCamera.getPicture(options).then(function(imageData) { + //$scope.user.newAvatar = "data:image/jpeg;base64," + imageData; $scope.user.avatar = "data:image/jpeg;base64," + imageData; + $scope.user.newAvatar = imageData; }, function(err) { console.log(err); }); + /*$cordovaCamera.getPicture(options).then(function(imageURI) { + $scope.user.avatar = imageURI; + $scope.user.newAvatar = imageURI; + }, function(err) { + console.log(err); + });*/ }; $scope.selectFaircoinPublicKey = function(){ console.log("img"); @@ -42,6 +50,7 @@ angular.module('app.editUser', ['pascalprecht.translate']) $cordovaCamera.getPicture(options).then(function(imageData) { $scope.user.faircoin = "data:image/jpeg;base64," + imageData; + $scope.user.newFaircoin = imageData; }, function(err) { console.log(err); }); diff --git a/www/js/travel.js b/www/js/travel.js index 7584b56..cc567c2 100644 --- a/www/js/travel.js +++ b/www/js/travel.js @@ -64,9 +64,9 @@ angular.module('app.travel', ['pascalprecht.translate', 'ui-leaflet']) confirmPopup.then(function(res) { if(res) { console.log('You are sure'); - console.log("delete travel: " + $stateParams.travelId); + console.log("delete travel: " + $stateParams.travelid); $http({ - url: urlapi + 'travels/' + $stateParams.travelId, + url: urlapi + '/travels/id/modify/' + $stateParams.travelid, method: "DELETE" }) .then(function(response) {