Skip to content

Commit

Permalink
fix: remove 数据万象 params
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Jan 15, 2024
1 parent 031cf8b commit 2a393b7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/ui/markdown/renderers/image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const GridMarkdownImages: FC<{

const GridZoomImage: FC<{ src: string }> = memo(({ src }) => {
const { accent, height, width } = useMarkdownImageRecord(src) || {}
const cropUrl = addImageUrlResizeQuery(src, 300)
const cropUrl = addImageUrlResizeQuery(src, 600)
const imageEl = useRef<HTMLImageElement>(null)
const wGreaterThanH = width && height ? width > height : true

Expand Down
8 changes: 4 additions & 4 deletions src/lib/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ export const addImageUrlCropSizeQuery = (url: string, size: number) => {
// Tencent Cloud 数据万象
// ?imageMogr2/thumbnail/300x/crop/300x300/gravity/center
parsedUrl.searchParams.set(
`imageMogr2/thumbnail/${size}x/crop/${size}x${size}/gravity/center`,
`imageMogr2/thumbnail/${size}x/crop/${size}x${size}/gravity/center/strip`,
'',
)

return parsedUrl.toString()
return parsedUrl.toString().replace(/=$/, '')
}

export const addImageUrlResizeQuery = (url: string, size: number) => {
const parsedUrl = new URL(url)

// Tencent Cloud 数据万象
// ?imageMogr2/thumbnail/300x
parsedUrl.searchParams.set(`imageMogr2/thumbnail/${size}x`, '')
parsedUrl.searchParams.set(`imageMogr2/thumbnail/${size}x/strip`, '')

return parsedUrl.toString()
return parsedUrl.toString().replace(/=$/, '')
}

1 comment on commit 2a393b7

@vercel
Copy link

@vercel vercel bot commented on 2a393b7 Jan 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

shiro – ./

shiro-innei.vercel.app
springtide.vercel.app
shiro-git-main-innei.vercel.app
innei.in

Please sign in to comment.