feat: display thumbnail on feed
This commit is contained in:
parent
af04aed6e8
commit
6821b92e63
1 changed files with 11 additions and 1 deletions
|
|
@ -32,7 +32,7 @@ export default function ImageGallery({
|
||||||
<img
|
<img
|
||||||
className={`rounded-lg max-w-full cursor-pointer ${size === 'small' ? 'max-h-[15vh]' : 'max-h-[30vh]'}`}
|
className={`rounded-lg max-w-full cursor-pointer ${size === 'small' ? 'max-h-[15vh]' : 'max-h-[30vh]'}`}
|
||||||
key={index}
|
key={index}
|
||||||
src={src}
|
src={getThumbUrl(src)}
|
||||||
onClick={(e) => handlePhotoClick(e, index)}
|
onClick={(e) => handlePhotoClick(e, index)}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
@ -53,3 +53,13 @@ export default function ImageGallery({
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getThumbUrl(url: string) {
|
||||||
|
if (url.startsWith('https://image.nostr.build/')) {
|
||||||
|
return url.replace('https://image.nostr.build/', 'https://image.nostr.build/thumb/')
|
||||||
|
}
|
||||||
|
if (url.startsWith('https://i.nostr.build/')) {
|
||||||
|
return url.replace('https://i.nostr.build/', 'https://i.nostr.build/thumb/')
|
||||||
|
}
|
||||||
|
return url
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue