Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

436 gallery 主题无缩略图未展示 #443

Merged
merged 2 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
7 changes: 5 additions & 2 deletions themes/gallery/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +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 thumbnailPath = `http://${config?.ip}:${config?.serverPort}/static/${id}/${image.name}_thumbnail.png`;
const host = `http://${config?.ip}:${config?.serverPort}`;
const src = `${host}/static/${id}/${image.name}.${image.ext}`;
const thumbnailPath = image.noThumbnail
? src
: `${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