mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 09:23:13 +01:00
fix thumbnail rendering for video
This commit is contained in:
parent
fe77d73979
commit
227cd2832d
@ -68,19 +68,21 @@ let MediaContainer = React.createClass({
|
||||
|
||||
isVideoEncoding() {
|
||||
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() {
|
||||
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');
|
||||
},
|
||||
|
||||
getEncodingMessage() {
|
||||
if (this.isVideoEncoding()) {
|
||||
const { digital_work: digitalWork } = this.props;
|
||||
const { content: { digital_work: digitalWork } } = this.props;
|
||||
|
||||
return (
|
||||
<div className="ascribe-detail-header ascribe-media-player">
|
||||
|
@ -68,10 +68,10 @@ let Image = React.createClass({
|
||||
|
||||
render() {
|
||||
const { url, thumbnail } = this.props;
|
||||
const urlFileExtension = extractFileExtensionFromUrl(url);
|
||||
|
||||
// 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 (
|
||||
<img className="shmui-ascribe" src={thumbnail} data-large-src={url} />
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user