fix: use intrinsicsize for images/videos (#935)

* fix: use intrinsicsize for images/videos

* add comment
This commit is contained in:
Nolan Lawson 2019-02-03 14:01:45 -08:00 committed by GitHub
parent 6d2b3ec072
commit f5be28d99a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -5,6 +5,7 @@
src={url}
{poster}
controls
{intrinsicsize}
ref:video
/>
{:elseif type === 'gifv'}
@ -18,6 +19,7 @@
loop
webkit-playsinline
playsinline
{intrinsicsize}
/>
{:else}
<img
@ -25,6 +27,7 @@
alt={description}
title={description}
src={url}
{intrinsicsize}
/>
{/if}
<style>
@ -41,7 +44,14 @@
url: ({ media }) => media.url,
description: ({ media }) => media.description || '',
poster: ({ media }) => media.poster,
static_url: ({ media }) => media.static_url
static_url: ({ media }) => media.static_url,
intrinsicsize: ({ media }) => {
if (media.meta && media.meta.original && media.meta.original.width && media.meta.original.height) {
let { width, height } = media.meta.original
return `${width} x ${height}`
}
return '' // pleroma does not give us original width/height
}
},
ondestroy () {
if (this.refs.video && !this.refs.video.paused) {