mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-06 17:33:18 +00:00
replace thumbnail by original image (#5634)
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import React, { Fragment } from 'react';
|
import React, { Fragment } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { siteRoot, thumbnailSizeForOriginal, username } from '../../utils/constants';
|
import { siteRoot, username } from '../../utils/constants';
|
||||||
import { Utils } from '../../utils/utils';
|
import { Utils } from '../../utils/utils';
|
||||||
import { seafileAPI } from '../../utils/seafile-api';
|
import { seafileAPI } from '../../utils/seafile-api';
|
||||||
import URLDecorator from '../../utils/url-decorator';
|
import URLDecorator from '../../utils/url-decorator';
|
||||||
@@ -318,20 +318,11 @@ class DirentGridView extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
prepareImageItem = (item) => {
|
prepareImageItem = (item) => {
|
||||||
const useThumbnail = !this.repoEncrypted;
|
|
||||||
const name = item.name;
|
const name = item.name;
|
||||||
|
|
||||||
const fileExt = name.substr(name.lastIndexOf('.') + 1).toLowerCase();
|
|
||||||
const isGIF = fileExt == 'gif';
|
|
||||||
|
|
||||||
const path = Utils.encodePath(Utils.joinPath(this.props.path, name));
|
|
||||||
const repoID = this.props.repoID;
|
const repoID = this.props.repoID;
|
||||||
let src;
|
const path = Utils.encodePath(Utils.joinPath(this.props.path, name));
|
||||||
if (useThumbnail && !isGIF) {
|
|
||||||
src = `${siteRoot}thumbnail/${repoID}/${thumbnailSizeForOriginal}${path}`;
|
const src = `${siteRoot}repo/${repoID}/raw${path}`;
|
||||||
} else {
|
|
||||||
src = `${siteRoot}repo/${repoID}/raw${path}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'name': name,
|
'name': name,
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import React, { Fragment } from 'react';
|
import React, { Fragment } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { siteRoot, gettext, thumbnailSizeForOriginal, username } from '../../utils/constants';
|
import { siteRoot, gettext, username } from '../../utils/constants';
|
||||||
import { Utils } from '../../utils/utils';
|
import { Utils } from '../../utils/utils';
|
||||||
import TextTranslation from '../../utils/text-translation';
|
import TextTranslation from '../../utils/text-translation';
|
||||||
import URLDecorator from '../../utils/url-decorator';
|
import URLDecorator from '../../utils/url-decorator';
|
||||||
@@ -155,20 +155,10 @@ class DirentListView extends React.Component {
|
|||||||
|
|
||||||
// for image popup
|
// for image popup
|
||||||
prepareImageItem = (item) => {
|
prepareImageItem = (item) => {
|
||||||
const useThumbnail = !this.repoEncrypted;
|
|
||||||
const name = item.name;
|
const name = item.name;
|
||||||
|
|
||||||
const fileExt = name.substr(name.lastIndexOf('.') + 1).toLowerCase();
|
|
||||||
const isGIF = fileExt == 'gif';
|
|
||||||
|
|
||||||
const path = Utils.encodePath(Utils.joinPath(this.props.path, name));
|
|
||||||
const repoID = this.props.repoID;
|
const repoID = this.props.repoID;
|
||||||
let src;
|
const path = Utils.encodePath(Utils.joinPath(this.props.path, name));
|
||||||
if (useThumbnail && !isGIF) {
|
const src = `${siteRoot}repo/${repoID}/raw${path}`;
|
||||||
src = `${siteRoot}thumbnail/${repoID}/${thumbnailSizeForOriginal}${path}`;
|
|
||||||
} else {
|
|
||||||
src = `${siteRoot}repo/${repoID}/raw${path}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'name': name,
|
'name': name,
|
||||||
|
Reference in New Issue
Block a user