diff options
| author | lambda <pleromagit@rogerbraun.net> | 2018-04-03 09:14:42 +0000 |
|---|---|---|
| committer | lambda <pleromagit@rogerbraun.net> | 2018-04-03 09:14:42 +0000 |
| commit | e4b2fdf1240571f1a3d4be743d73d2b8207b7ba6 (patch) | |
| tree | 8d21d76ef7471df36b3e0468e06b3870b280c714 /src/components/still-image/still-image.js | |
| parent | 214dd1f6d14073c26316bf5344f03b4b6af999b2 (diff) | |
| parent | 0c4dc26808c3bb7508bf9005f3c3430f1c7e2039 (diff) | |
Merge branch 'stillGifs' into 'develop'
Still gifs
See merge request pleroma/pleroma-fe!193
Diffstat (limited to 'src/components/still-image/still-image.js')
| -rw-r--r-- | src/components/still-image/still-image.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/components/still-image/still-image.js b/src/components/still-image/still-image.js new file mode 100644 index 00000000..0839aca5 --- /dev/null +++ b/src/components/still-image/still-image.js @@ -0,0 +1,26 @@ +const StillImage = { + props: [ + 'src', + 'referrerpolicy', + 'mimetype' + ], + data () { + return { + stopGifs: this.$store.state.config.stopGifs + } + }, + computed: { + animated () { + return this.stopGifs && (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 |
