aboutsummaryrefslogtreecommitdiff
path: root/src/components/still-image/still-image.js
blob: fa027bc4fbac57c94bf24eda79ae777f3ebe8169 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import fileTypeService from '../../services/file_type/file_type.service.js'

const StillImage = {
  props: [
    'src',
    'referrerpolicy',
    'mimetype'
  ],
  data () {
    return {
      hideNsfwLocal: this.$store.state.config.hideNsfw,
    }
  },
  computed: {
    animated () {
      return this.mimetype === 'image/gif'
    }
  },
  methods: {
    drawCanvas() {
      const canvas = this.$refs.canvas
      if (!canvas) return
      const ctx = canvas.getContext('2d')
      ctx.drawImage(this.$refs.src, 1, 1, canvas.width, canvas.height)
    }
  }
}

export default StillImage