Kaynağa Gözat

修改图片

dgf 8 yıl önce
ebeveyn
işleme
7efe1f32d7

BIN
dist/img/Loading.gif


+ 1 - 0
talkview/src/html/index.html

@@ -12,6 +12,7 @@
     <!--<script src="js/jquery.min.js"></script>-->
     <script src="../bower_components/lodash/dist/lodash.js"></script>
     <script src="../bower_components/jquery/dist/jquery.min.js"></script>
+    <script src="../bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
     <script src="../bower_components/jquery-qrcode/jquery.qrcode.min.js"></script>
     <script src="../bower_components/angular/angular.js"></script>
     <script src="../bower_components/angular-ui-router/release/angular-ui-router.min.js"></script>

+ 29 - 4
talkview/src/js/directive/currentmessage.js

@@ -65,10 +65,16 @@
                 var g = (/\[image\-src=\"([\w\W]+?)\"\]/i).exec(content);
                 while (g !== null) {
                     content = content.replace(g[0], function() {
-                        var html = '<a href="local://' + scope.appContent.directory.received + g[1] + '.JPG' + '" target="_blank" class="thumbnail"' + '>' +
-                            '<img style="max-width:270px;max-height:250px;" src="local://' + scope.appContent.directory.received + g[1] + '.JPG' + '" alt="" >' +
+                        scope.imgWidth = 715;
+                        scope.imgHeight = 395;
+                        var html = '<a class="thumbnail"' + '>' +
+                            '<img onclick="javascript:window.open(this.src,\'\',\'height=' + scope.imgHeight + ',width=' + scope.imgWidth + ',top=200,left=200,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no\')" style="max-width:270px;max-height:250px;" src="local://' + scope.appContent.directory.received + g[1] + '.png' + '" onError= "this.src = \'../img/loading.gif\'" alt="截图缩略图" >' +
                             '</a>';
-                        loadImg("local://" + scope.appContent.directory.received + g[1] + ".JPG", addImg);
+                        // '<div class="bigImg">' +
+                        // '<img ng-click="hover = false" ng-show="hover" src="local://' + scope.appContent.directory.received + g[1] + '.JPG' + '" alt="" >' +
+                        // '</div>';
+
+                        loadImg("local://" + scope.appContent.directory.received + g[1] + ".png", addImg, error);
 
                         function loadImg(url, callback) {
                             var img = new Image();
@@ -76,12 +82,25 @@
                                 img.onload = null;
                                 callback(img);
                             }
+                            img.onerror = function() {
+                                //alert("error!");
+                                img.onerror = null;
+                                error(img);
+                            }
                             img.src = url;
-                            //img.attr("defaulturl", "../images/img.png");
+                            angular.element("img").attr("defaulturl", "../img/loading.jpg");
+                        }
+
+                        function error(img) {
+                            gotoBottom();
                         }
 
                         function addImg(img) {
                             //$(img).appendTo($(".image"));
+                            scope.imgWidth = img.width;
+                            scope.imgHeight = img.height;
+                            console.log(scope.imgHeight);
+                            console.log(scope.imgWidth);
                             gotoBottom();
                         }
                         return html;
@@ -231,5 +250,11 @@
             return lxtalkClient.Invoke('{15180DEF-D508-45F7-BAEB-6486CD8752C8}', 'OpenDirectory', JSON.stringify(file), $scope);
 
         };
+        // $scope.showBigImg = function(str) {
+        //     str = "local://E:\ZWT\Users\002682BECE10-kehu01\ReceivedFaces\55d8b2073fb83e2450eff0fccbb85ab4.JPG";
+        //     console.log(str);
+        //     var newwin = window.open();
+        //     newwin.document.write("<img src=" + str + " />");
+        // }
     }
 })();

+ 6 - 3
talkview/src/less/app.main.less

@@ -24,9 +24,6 @@
     #sendmessage {
         margin-top: -10px;
     }
-    #bottom {
-        
-    }
 }
 
 .media-body {
@@ -130,6 +127,12 @@
         max-width: 300px;
         max-height: 300px;
     }
+    .bigImg{
+        z-index: 99;
+        position: fixed;
+        top: 50%;
+        left: 50%;
+    }
 }
 
 .contact-box.center-version {