Skip to content

Commit

Permalink
fix: 【Gallery 主题】无缩略图未展示
Browse files Browse the repository at this point in the history
  • Loading branch information
meetqy committed Oct 6, 2023
1 parent d6b7019 commit 6d199fa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/api/src/sync/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export const upsertImage = async (p: Pending, timeout = 3000) => {
annotation: newImage.annotation,
url: newImage.url,
duration: newImage.duration,
noThumbnail: newImage.noThumbnail ?? false,
// 文件夹只需要关联,删除处理在 handleFolder 中处理,删除 folder 会同时删除关联的 image
folders: { connect: newImage.folders },
tags,
Expand Down
5 changes: 3 additions & 2 deletions themes/gallery/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,11 @@ function Home() {
{pages?.map((page) => {
const photos = page.data?.map((image) => {
const id = image.path.split("/").slice(-2)[0];
const src = `http://${config?.ip}:${config?.serverPort}/static/${id}/${image.name}.${image.ext}`;
const host = `http://${config?.ip}:${config?.serverPort}`;
const src = `${host}/static/${id}/${image.name}.${image.ext}`;
const thumbnailPath = image.noThumbnail
? src
: `http://${config?.ip}:${config?.serverPort}/static/${id}/${image.name}_thumbnail.png`;
: `${host}/static/${id}/${image.name}_thumbnail.png`;

return {
id: image.id,
Expand Down
1 change: 1 addition & 0 deletions tooling/typescript/base.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ declare global {
width: number;
duration: number;
lastModified: number;
noThumbnail: boolean?;
palettes: MetadataPalette[];
}

Expand Down

0 comments on commit 6d199fa

Please sign in to comment.