JQuery读取Exif信息

<!DOCTYPE html>
<html>
<head>
    <script type="text/javascript" src="jquery-1.7.1.js"></script>
    <script type="text/javascript" src="jquery.exif.js"></script>
</head>
<body>
    <form id="myform">
        <input type="file" id="file" /> </br>
    </form>
    
    <script>
        var re='';
          function addInfo(str){
              re+=(str+'\r\n');
          }
          
          function getResult(){
              alert(re);
          }
          
        var someCallback = function(exifObject) {
            var t = exifObject.ExposureTime ;   
            if ( t < 1 ) {   
                t = "1/" + Math. round ( 1 / t ) + "";   
            } else {   
                t = t + "" ;   
            }   
            addInfo('相机:'+exifObject.Make);
            addInfo('型号:'+exifObject.Model);
            addInfo('快门:'+t);
            addInfo('光圈:F'+exifObject.FNumber);
            addInfo('焦段:'+exifObject.FocalLength+'mm');
            addInfo('ISO:'+exifObject.ISOSpeedRatings);
            addInfo('白平衡:'+exifObject.WhiteBalance);
            addInfo('日期:'+exifObject.DateTime);
            //addInfo('曝光补偿:'+exifObject.ExposureBias);
            
            getResult();
            // Uncomment the line below to examine the
            // EXIF object in console to read other values
            //console.log(exifObject);
        }

      try {
        $('#file').change(function() {
            $(this).fileExif(someCallback);
        });
      }
      catch (e) {
        alert(e);
      }
    </script>
</body>
</html>

 

posted @ 2015-10-28 14:57  旋转木马的IT小窝  阅读(1024)  评论(0编辑  收藏  举报

回到顶部