0.1.1 • Published 8 years ago

@fengyuanchen/exif v0.1.1

Weekly downloads
7
License
MIT
Repository
github
Last release
8 years ago

Exif

JavaScript Exif reader (only available in the browser).

Install

npm install @fengyuanchen/exif
<script src="/path/to/exif.js"></script>

Usage

Four available usages:

  • new Exif(HTMLImageElement, options)
  • new Exif(HTMLImageElement.src, options)
  • new Exif(File, options)
  • new Exif(Blob, options)

Example:

<img id="image" src="image.jpg">
var image = document.getElementById('image');
var exif = new Exif(image, {
  done: function(tags) {
    console.log(tags);
  }
});

Options

You may set cropper options with new Exif(image, options).

exif

  • Type: Boolean
  • Default: true

Read Exif tags.

gps

  • Type: Boolean
  • Default: true

Read GPS tags.

interoperability

  • Type: Boolean
  • Default: true

Read interoperability tags.

ignored

  • Type: Array or Boolean
  • Default: ['MakerNote', 'UserComment']

Assign the ignored tags. Set false to disable it.

done

  • Type: Function
  • Default: null

Read success callback.

new Exif(image, {
  done: function(tags) {
    console.log(tags);
  }
});

fail

  • Type: Function
  • Default: null

Read error callback.

new Exif(image, {
  fail: function(message) {
    console.log(message);
  }
});

No conflict

If you have to use other global function with the same namespace, just call the Exif.noConflict static method to revert to it.

<script src="other-exif.js"></script>
<script src="exif.js"></script>
<script>
  Exif.noConflict();
  // Code that uses other `Exif` can follow here.
</script>

Browser support

  • Chrome (latest 2)
  • Firefox (latest 2)
  • Internet Explorer 10+
  • Opera (latest 2)
  • Safari (latest 2)

License

MIT © Fengyuan Chen