summary refs log tree commit diff
path: root/webclient/room/room-controller.js
diff options
context:
space:
mode:
Diffstat (limited to 'webclient/room/room-controller.js')
-rw-r--r--webclient/room/room-controller.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js
index 30f66de458..5ea01d7641 100644
--- a/webclient/room/room-controller.js
+++ b/webclient/room/room-controller.js
@@ -402,6 +402,23 @@ angular.module('RoomController', ['ngSanitize'])
             });
     };
     
+    $scope.imageFileToSend;
+    $scope.$watch("imageFileToSend", function(newValue, oldValue) {
+        if ($scope.imageFileToSend) {
+            // First download the image to the Internet
+            console.log("Uploading image...");
+            mFileUpload.uploadFile($scope.imageFileToSend).then(
+                function(url) {
+                    // Then share the URL
+                    $scope.sendImage(url);
+                },
+                function(error) {
+                    $scope.feedback = "Can't upload image";
+                } 
+            );
+        }
+    });
+    
     $scope.loadMoreHistory = function() {
         paginate(MESSAGES_PER_PAGINATION);
     };