1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-09 10:50:24 +00:00

change default thumbnail size (#6710)

* change default thumbnail size

* change py test file

* change thumbnail image size
This commit is contained in:
Michael An
2024-09-05 14:56:52 +08:00
committed by GitHub
parent eaf2114643
commit fba6f9735e
19 changed files with 56 additions and 43 deletions

View File

@@ -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, thumbnailDefaultSize, thumbnailSizeForOriginal } from '../../utils/constants';
import { Utils } from '../../utils/utils';
import { seafileAPI } from '../../utils/seafile-api';
import URLDecorator from '../../utils/url-decorator';
@@ -566,14 +566,13 @@ class DirentGridView extends React.Component {
const name = item.name;
const repoID = this.props.repoID;
const path = Utils.encodePath(Utils.joinPath(this.props.path, name));
const cacheBuster = new Date().getTime();
const src = `${siteRoot}repo/${repoID}/raw${path}?t=${cacheBuster}`;
return {
'name': name,
'url': `${siteRoot}lib/${repoID}/file${path}`,
'src': src
'thumbnail': `${siteRoot}thumbnail/${repoID}/${thumbnailSizeForOriginal}${path}`,
'src': `${siteRoot}repo/${repoID}/raw${path}?t=${cacheBuster}`,
};
};
@@ -630,7 +629,7 @@ class DirentGridView extends React.Component {
if (imageIndex >= 0 && angle !== 0) {
const path = this.state.path === '/' ? this.props.path + this.state.imageItems[imageIndex].name : this.props.path + '/' + this.state.imageItems[imageIndex].name;
imageAPI.rotateImage(this.props.repoID, path, 360 - angle).then((res) => {
seafileAPI.createThumbnail(this.props.repoID, path, 48).then((res) => {
seafileAPI.createThumbnail(this.props.repoID, path, thumbnailDefaultSize).then((res) => {
// Generate a unique query parameter to bust the cache
const cacheBuster = new Date().getTime();
const newThumbnailSrc = `${res.data.encoded_thumbnail_src}?t=${cacheBuster}`;