fix: use intrinsicsize for images/videos (#935)
* fix: use intrinsicsize for images/videos * add comment
This commit is contained in:
		
							parent
							
								
									6d2b3ec072
								
							
						
					
					
						commit
						f5be28d99a
					
				
					 1 changed files with 11 additions and 1 deletions
				
			
		| 
						 | 
					@ -5,6 +5,7 @@
 | 
				
			||||||
    src={url}
 | 
					    src={url}
 | 
				
			||||||
    {poster}
 | 
					    {poster}
 | 
				
			||||||
    controls
 | 
					    controls
 | 
				
			||||||
 | 
					    {intrinsicsize}
 | 
				
			||||||
    ref:video
 | 
					    ref:video
 | 
				
			||||||
  />
 | 
					  />
 | 
				
			||||||
{:elseif type === 'gifv'}
 | 
					{:elseif type === 'gifv'}
 | 
				
			||||||
| 
						 | 
					@ -18,6 +19,7 @@
 | 
				
			||||||
    loop
 | 
					    loop
 | 
				
			||||||
    webkit-playsinline
 | 
					    webkit-playsinline
 | 
				
			||||||
    playsinline
 | 
					    playsinline
 | 
				
			||||||
 | 
					    {intrinsicsize}
 | 
				
			||||||
  />
 | 
					  />
 | 
				
			||||||
{:else}
 | 
					{:else}
 | 
				
			||||||
  <img
 | 
					  <img
 | 
				
			||||||
| 
						 | 
					@ -25,6 +27,7 @@
 | 
				
			||||||
    alt={description}
 | 
					    alt={description}
 | 
				
			||||||
    title={description}
 | 
					    title={description}
 | 
				
			||||||
    src={url}
 | 
					    src={url}
 | 
				
			||||||
 | 
					    {intrinsicsize}
 | 
				
			||||||
  />
 | 
					  />
 | 
				
			||||||
{/if}
 | 
					{/if}
 | 
				
			||||||
<style>
 | 
					<style>
 | 
				
			||||||
| 
						 | 
					@ -41,7 +44,14 @@
 | 
				
			||||||
      url: ({ media }) => media.url,
 | 
					      url: ({ media }) => media.url,
 | 
				
			||||||
      description: ({ media }) => media.description || '',
 | 
					      description: ({ media }) => media.description || '',
 | 
				
			||||||
      poster: ({ media }) => media.poster,
 | 
					      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 () {
 | 
					    ondestroy () {
 | 
				
			||||||
      if (this.refs.video && !this.refs.video.paused) {
 | 
					      if (this.refs.video && !this.refs.video.paused) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue