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

Usage with Next.js image component #2105

Open
branislavbrincko opened this issue Jun 12, 2024 · 1 comment
Open

Usage with Next.js image component #2105

branislavbrincko opened this issue Jun 12, 2024 · 1 comment

Comments

@branislavbrincko
Copy link

I would like to use Next.js image component for the image displayed in lightbox (to take advantage of the Next.js optimizations, like not showing extra large images on mobile). Can this be done? Thanks in advance.

@televators
Copy link

Are you trying to use photoswipe directly or something like react-photoswipe-gallery? If you're using react-photoswipe-gallery, this is how I'm doing it and it works fine:

<Item original={imageUrl} thumbnail={imageUrl} width='1000' height='600'>
    {({ ref, open }) => (
      <Image
        src={imageUrl}
        alt=''
        width={1000}
        height={600}
        ref={ref}
        onClick={open}
      />
    )}
</Item>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants