aboutsummaryrefslogtreecommitdiff
path: root/src/components/still-image/still-image.js
blob: f0b25265f4b0250a78edf71dec9dc835cdc23d21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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