Skip to content

Instantly share code, notes, and snippets.

@LoveMeWithoutAll
Created July 19, 2018 02:41
Show Gist options
  • Save LoveMeWithoutAll/7653d8aeccc3a50af80ded028f8a4d99 to your computer and use it in GitHub Desktop.
Save LoveMeWithoutAll/7653d8aeccc3a50af80ded028f8a4d99 to your computer and use it in GitHub Desktop.
Vue exif information getter
<!DOCTYPE html>
<html>
<head>
<script src="https://unpkg.com/vue"></script>
<script src="https://unpkg.com/vue-picture-input"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/exif-js/2.3.0/exif.js" async></script>
<title>Vue exif getter In the browser!</title>
</head>
<body>
<div id="app">
<p>{{ message }}</p>
<picture-input ref="pictureInput" @change="onChange"></picture-input>
</div>
<script>
var app = new Vue({
el: '#app',
data: {
message: 'Vue exif meta info getter'
},
components: {
'picture-input': PictureInput
},
methods: {
onChange (image) {
console.log('onChange!')
if (image) {
EXIF.getData(this.$refs.pictureInput.file, function() {
console.log('image info', this)
console.log('exif data', this.exifdata)
})
} else {
console.log(`it's not image`)
}
}
}
})
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment