jquery.exif没有从显示的照片中加载exif数据

时间:2014-02-23 15:57:15

标签: exif

我无法从显示的图片地址获取exif数据

点击照片你应该看到exif数据。

var someCallback = function(e) {
    $('#cameraModel').val(e.Model);
    $('#aperture').val(e.FNumber);
    $('#created').val(e.DateTime);
    $('#taken').val(e.DateTimeOriginal);
    $('#copyright').val(e.Copyright);
    $('#description').val(e.ImageDescription);
    $('#artist').val(e.Artist);
    $('#latitude').val(e.GPSLatitude[2]);
    $('#longitude').val(e.GPSLongitude[2]);
    //Uncomment the line below to examine the
    //EXIF object in console to read other values
    //console.log(e);
}

$('#fdd').on('click', function (e) {
    alert($(this).attr("src"));
    $(this).fileExif(someCallback);
});

请帮助...... jsfiddle

1 个答案:

答案 0 :(得分:1)

从小提琴开始,您尝试使用https://github.com/sanisoft/jQuery-fileExif中的fileExif方法。你有几个问题:

  • 您没有在您的小提琴中加载库(因此我不得不猜测您尝试使用哪个库。提示:阅读控制台日志,像Uncaught TypeError: Object [object Object] has no method 'fileExif'这样的消息意味着您丢失了代码或尝试对错误的对象进行调用)

  • 该库无法加载到小提琴中,因为它使用了document.write。您可以从插件中删除此代码,以使其在小提琴中工作;它只需要IE:

document.write(
    "<script type='text/vbscript'>\r\n"
    + "Function IEBinary_getByteAt(strBinary, iOffset)\r\n"
    + " IEBinary_getByteAt = AscB(MidB(strBinary,iOffset+1,1))\r\n"
    + "End Function\r\n"
    + "Function IEBinary_getLength(strBinary)\r\n"
    + " IEBinary_getLength = LenB(strBinary)\r\n"
    + "End Function\r\n"
    + "</script>\r\n"
);