1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 17:33:14 +01:00

fix thumbnail rendering for video

This commit is contained in:
Tim Daubenschütz 2016-03-10 17:07:11 +01:00
parent fe77d73979
commit 227cd2832d
2 changed files with 7 additions and 5 deletions

View File

@ -68,19 +68,21 @@ let MediaContainer = React.createClass({
isVideoEncoding() { isVideoEncoding() {
const { content: { digital_work: digitalWork } } = this.props; const { content: { digital_work: digitalWork } } = this.props;
return digitalWork.mime === 'video' && digitalWork.isEncoding === 'number' && digitalWork.isEncoding !== 100; return digitalWork.mime === 'video' && typeof digitalWork.isEncoding === 'number' && digitalWork.isEncoding !== 100;
}, },
isImageEncoding() { isImageEncoding() {
const { content: { thumbnail, digital_work: digitalWork } } = this.props; const { content: { thumbnail, digital_work: digitalWork } } = this.props;
const thumbnailFileExtension = extractFileExtensionFromUrl(thumbnail.thumbnail_sizes['600x600']); const thumbnailToCheck = thumbnail.thumbnail_sizes && thumbnail.thumbnail_sizes['600x600'] ? thumbnail.thumbnail_sizes['600x600']
: thumbnail.url;
const thumbnailFileExtension = extractFileExtensionFromUrl(thumbnailToCheck);
return digitalWork.mime === 'image' && (thumbnailFileExtension === 'tif' || thumbnailFileExtension === 'tiff'); return digitalWork.mime === 'image' && (thumbnailFileExtension === 'tif' || thumbnailFileExtension === 'tiff');
}, },
getEncodingMessage() { getEncodingMessage() {
if (this.isVideoEncoding()) { if (this.isVideoEncoding()) {
const { digital_work: digitalWork } = this.props; const { content: { digital_work: digitalWork } } = this.props;
return ( return (
<div className="ascribe-detail-header ascribe-media-player"> <div className="ascribe-detail-header ascribe-media-player">

View File

@ -68,10 +68,10 @@ let Image = React.createClass({
render() { render() {
const { url, thumbnail } = this.props; const { url, thumbnail } = this.props;
const urlFileExtension = extractFileExtensionFromUrl(url);
// TIFFs can not be displayed by the browser, so we just display their thumbnail // TIFFs can not be displayed by the browser, so we just display their thumbnail
if (url && urlFileExtension !== 'tif' && urlFileExtension !== 'tiff') { // url is not necessarily defined, which would cause this function to fail
if (url && extractFileExtensionFromUrl(url) !== 'tif' && extractFileExtensionFromUrl(url) !== 'tiff') {
return ( return (
<img className="shmui-ascribe" src={thumbnail} data-large-src={url} /> <img className="shmui-ascribe" src={thumbnail} data-large-src={url} />
); );