akkoma-fe/src/components/still-image/still-image.js
Henry Jameson 5efd8a4aa6 fixes
2018-03-12 01:30:27 +03:00

21 lines
424 B
JavaScript

const StillImage = {
props: [
'src',
'referrerpolicy',
'mimetype'
],
computed: {
animated () {
return this.mimetype === 'image/gif' || this.src.endsWith('.gif')
}
},
methods: {
onLoad () {
const canvas = this.$refs.canvas
if (!canvas) return
canvas.getContext('2d').drawImage(this.$refs.src, 1, 1, canvas.width, canvas.height)
}
}
}
export default StillImage