akkoma-fe/src/components/still-image/still-image.js

22 lines
424 B
JavaScript
Raw Normal View History

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