【问题标题】:How to extact specific information from the exif data and display it in our Web page/如何从exif数据中提取特定信息并显示在我们的网页中/
【发布时间】:2020-03-01 16:02:18
【问题描述】:

我正在使用来自here 的 exif.js。 我目前使用EXIF.getData()从我的img中提取了所有数据,并将其显示在我的图片旁边。

但现在我想显示的不是所有数据,而是要具体说明什么(相机型号、拍照日期、图片是否有标签等)。

我的图片是我的 JSON 文件,我已经为所有图片添加了标签。 我不知道如何处理它。我应该使用 EXIF.getData() 并从那里开始吗?我在模态对话框中提取 IMG 点击数据。

     function clickImage(){
        let images = $(".box img");
        images.click(function() {
            modalContent.attr('src', $(this).attr('src'));
            modalView.css('display', 'block');
            googleMap.css('display','none');

             EXIF.getData(this, function() {
               result.text(EXIF.pretty(this))
          }          
     } 

目前,我在result中给出了所有日期。

【问题讨论】:

  • 到目前为止,我已经做到了:

标签: javascript exif


【解决方案1】:

你应该使用exifr而不是exif-js,因为它已经两年没有维护了,并且仍然存在重大错误(n未定义)。

使用 exifr,您可以解析所有内容

exifr.parse('./myimage.jpg').then(output => {
  console.log('Camera:', output.Make, output.Model))
})

或者只是几个标签

let output = await exifr.parse(file, ['ISO', 'Orientation', 'LensModel'])

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-01-03
    • 2021-04-20
    • 2011-09-21
    • 2017-02-17
    • 2015-06-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多