mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-03 16:10:26 +00:00
[11.0] tiff image use thumbnail image to preview in list view and grid view (#6933)
* [11] Tiff image use thumbnail image to preview * only tiff use thumbnail
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React, { Fragment } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { siteRoot, username, enableSeadoc } from '../../utils/constants';
|
||||
import { siteRoot, username, enableSeadoc, thumbnailSizeForOriginal } from '../../utils/constants';
|
||||
import { Utils } from '../../utils/utils';
|
||||
import { seafileAPI } from '../../utils/seafile-api';
|
||||
import URLDecorator from '../../utils/url-decorator';
|
||||
@@ -355,7 +355,14 @@ class DirentGridView extends React.Component {
|
||||
const repoID = this.props.repoID;
|
||||
const path = Utils.encodePath(Utils.joinPath(this.props.path, name));
|
||||
|
||||
const src = `${siteRoot}repo/${repoID}/raw${path}`;
|
||||
const fileExt = name.substr(name.lastIndexOf('.') + 1).toLowerCase();
|
||||
const isTIFF = fileExt == 'tiff';
|
||||
let src = '';
|
||||
if (isTIFF) {
|
||||
src = `${siteRoot}thumbnail/${repoID}/${thumbnailSizeForOriginal}${path}`;
|
||||
} else {
|
||||
src = `${siteRoot}repo/${repoID}/raw${path}`;
|
||||
}
|
||||
|
||||
return {
|
||||
'name': name,
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import React, { Fragment } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { siteRoot, gettext, username, enableSeadoc } from '../../utils/constants';
|
||||
import { siteRoot, gettext, username, enableSeadoc, thumbnailSizeForOriginal } from '../../utils/constants';
|
||||
import { Utils } from '../../utils/utils';
|
||||
import TextTranslation from '../../utils/text-translation';
|
||||
import URLDecorator from '../../utils/url-decorator';
|
||||
@@ -163,7 +163,14 @@ class DirentListView extends React.Component {
|
||||
const name = item.name;
|
||||
const repoID = this.props.repoID;
|
||||
const path = Utils.encodePath(Utils.joinPath(this.props.path, name));
|
||||
const src = `${siteRoot}repo/${repoID}/raw${path}`;
|
||||
const fileExt = name.substr(name.lastIndexOf('.') + 1).toLowerCase();
|
||||
const isTIFF = fileExt == 'tiff';
|
||||
let src = '';
|
||||
if (isTIFF) {
|
||||
src = `${siteRoot}thumbnail/${repoID}/${thumbnailSizeForOriginal}${path}`;
|
||||
} else {
|
||||
src = `${siteRoot}repo/${repoID}/raw${path}`;
|
||||
}
|
||||
|
||||
return {
|
||||
'name': name,
|
||||
|
Reference in New Issue
Block a user