Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jquery.exif不从显示的照片加载exif数据_Exif - Fatal编程技术网

jquery.exif不从显示的照片加载exif数据

jquery.exif不从显示的照片加载exif数据,exif,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.Cop

我无法从显示的图像地址获取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);
});

请帮忙

在fiddle中,您试图使用来自的fileExif方法。这里有几个问题:

  • 您没有在小提琴中加载库(因此我不得不猜测您尝试使用的库。提示:阅读控制台日志,会出现类似
    uncaughttypeerror:Object[Object Object]没有方法“fileExif”
    的消息,表示您缺少代码或尝试调用错误的对象)

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

document.write(
“\r\n”
+函数IEBinary\u getByteAt(标准二进制,iOffset)\r\n
+IEBinary\u getByteAt=AscB(MidB(标准二进制,iOffset+1,1))\r\n
+“结束函数\r\n”
+“函数IEBinary\u getLength(标准二进制)\r\n”
+“IEBinary\u getLength=LenB(标准二进制)\r\n”
+“结束函数\r\n”
+“\r\n”
);
  • 你用错了图书馆。这是一个文件上传,而不是图像元素。您应该尝试使用原始的jquery exif插件,如下所示:

你的小提琴没有加载jquery.exif.js?事实证明,您不能直接使用该库,因为它使用document.write。如果你将插件中的代码粘贴到你的提琴中,并删除文档。编写代码片段(仅适用于IE),那么你会得到更进一步的信息。您好。谢谢我忘了添加库了。。但是图书馆有个问题。我需要使用fileExif方法。请参阅Fiddel的新版本:读取控制台错误。您不能在小提琴中使用来自该站点的图像,因为它们不发送CORS标题。一个允许访问的图像示例:(查看开发人员工具中的响应头)但是,由于jquery exif试图发出HEAD请求,它还需要发出OPTIONS请求,CORS才能工作,而wikimedia不支持这一点。如果您托管自己的代码而不是使用小提琴,所有这些问题都会消失。
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"
);