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:
commit
55dc1c997a
@ -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">
|
||||||
|
@ -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} />
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user