1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 09:23:13 +01:00

Merge pull request #176 from ascribe/AG-172-fix-thumbnail-creation-for-videos

fix thumbnail rendering for video
This commit is contained in:
Tim Daubenschütz 2016-03-10 17:13:59 +01:00
commit 55dc1c997a
2 changed files with 7 additions and 5 deletions

View File

@ -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">

View File

@ -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} />
);