fix: add thumbnail param only for internal link (#1701)

* fix: add thumbnail param using `URLSearchParams`

* update: add thumnail param only for internal link
This commit is contained in:
Zeng1998 2023-05-21 16:41:04 +08:00 committed by GitHub
parent 6bb0b4cd47
commit 1e4a867a9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -46,7 +46,12 @@ const MemoResourceListView: React.FC<Props> = (props: Props) => {
if (resource.type.startsWith("image")) {
return (
<SquareDiv key={resource.id} className="memo-resource">
<img src={absolutifyLink(url) + "?thumbnail=1"} onClick={() => handleImageClick(url)} decoding="async" loading="lazy" />
<img
src={resource.externalLink ? url : url + "?thumbnail=1"}
onClick={() => handleImageClick(url)}
decoding="async"
loading="lazy"
/>
</SquareDiv>
);
} else if (resource.type.startsWith("video")) {

View File

@ -44,7 +44,7 @@ const ResourceCover = ({ resource }: ResourceCoverProps) => {
<SquareDiv className="h-20 w-20 flex items-center justify-center overflow-clip">
<img
className="max-w-full max-h-full object-cover shadow"
src={resourceUrl + "?thumbnail=1"}
src={resource.externalLink ? resourceUrl : resourceUrl + "?thumbnail=1"}
onClick={() => showPreviewImageDialog(resourceUrl)}
/>
</SquareDiv>