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

[Feature Suggestion] Ability to show file name, and metadata along with the image #37

Closed
joepangyw opened this issue Sep 28, 2023 · 10 comments

Comments

@joepangyw
Copy link

joepangyw commented Sep 28, 2023

Ability to show file name in carousel, and metadata of image within the lightbox.

@joepangyw joepangyw changed the title Ability to show file name, and metadata along with the image [Feature Suggestion] Ability to show file name, and metadata along with the image Sep 28, 2023
@silvia-odwyer
Copy link
Owner

@joepangyw Hi Joe,
Thanks for this feature request! Before I get started on adding this new feature, I'm just wondering where you'd like the file name to be placed in the lightbox. Also, could you let me know what image metadata would you like to be displayed?

@joepangyw
Copy link
Author

joepangyw commented Sep 28, 2023

@silvia-odwyer Hi

I have done up some mockups for your reference.

Metadata such as resolution, time captured, or even camera settings when the photo was taken.

@silvia-odwyer
Copy link
Owner

silvia-odwyer commented Oct 14, 2023

@joepangyw Hi Joe,
I've just added this feature to the library, you can enable the lightbox to show image metadata by setting the displayMetadata prop to true.

<SlideshowLightbox displayMetadata={true}>
...
</SlideshowLightbox>

It will then display the image filename in the sidebar; other details such as the resolution, time captured and camera settings will also be shown if these exist as part of the EXIF metadata.

Hopefully that helps, and let me know if you have any queries or would like any edits/updates.

@joepangyw
Copy link
Author

Hi @silvia-odwyer,

I am unable to find this in this current library.

@silvia-odwyer
Copy link
Owner

@joepangyw I'll take a look into this to see what may be causing the issue. I'm just wondering if you're using React or Next.js?

@joepangyw
Copy link
Author

@silvia-odwyer I'm using React with Tailwind

@silvia-odwyer
Copy link
Owner

silvia-odwyer commented Oct 23, 2023

@joepangyw Be sure to also pass an array to the images prop for the SlideshowLightbox component, which contains an array of images that you want to display. Here's an example:

let images = [
  {
    src: 'https://upload.wikimedia.org/wikipedia/commons/8/8f/Paysage_de_Guin%C3%A9e_07.jpg',
    alt: 'Clouds in the sky',
  },
  {
    src: 'https://source.unsplash.com/rsAeSMzOX9Y/768x512',
    alt: 'Mechanical keyboard with white, pastel green and red keycaps.',
  },
  {
    src: 'https://source.unsplash.com/Z6SXt1v5tP8/768x512',
    alt: 'Mechanical keyboard with white, pastel pink, yellow and red keycaps.',
  },
]

Here's the JSX:

<SlideshowLightbox
    images={images} 
    displayMetadata={true}
    open={isOpen}
    onClose={() => {setIsOpen(false)}}
    showThumbnails={false}
>
...      
</SlideshowLightbox>

Here's what the first photo looks like with the metadata:
image

Hopefully that helps, and let me know if you have any queries.

@joepangyw
Copy link
Author

joepangyw commented Oct 25, 2023

@silvia-odwyer any idea why it's not working for me?

let images = [
    {
      src: 'https://upload.wikimedia.org/wikipedia/commons/8/8f/Paysage_de_Guin%C3%A9e_07.jpg',
      alt: 'Clouds in the sky',
    },
    {
      src: '../../images/IMG_9580.jpg',
      alt: 'photo',
    },
    {
      src: '../../images/IMG_9634.jpg',
      alt: 'photo',
    },
    {
      src: '../../images/IMG_9643.jpg',
      alt: 'photo',
    },
    {
      src: '../../images/IMG_9694.jpg',
      alt: 'photo',
    },
    {
      src: '../../images/IMG_9665.jpg',
      alt: 'photo',
    },
  ]
<SlideshowLightbox
    className='grid grid-cols-4 gap-20 mx-auto'
    images={images}
    displayMetadata={true}
    showThumbnails={true}
    theme="day"
    modalClose="clickOutside"
    startingSlideIndex={0}
    slideshowInterval={4000}
/>

image

@silvia-odwyer
Copy link
Owner

silvia-odwyer commented Nov 3, 2023

@joepangyw I'm just wondering if you're using the latest version of lightbox.js-react? I've tried the JSX and code you've provided above for the first image and it is working for me. Is the first image working for you, if you remove the other images?

let images = [
    {
      src: 'https://upload.wikimedia.org/wikipedia/commons/8/8f/Paysage_de_Guin%C3%A9e_07.jpg',
      alt: 'Clouds in the sky',
    }
  ]

If this works, but then you add the other images, and the metadata isn't displayed, then it may be related to the other images specified. I would need a full example with the links to all images in the array so that I can reproduce the issue. Thanks!

@joepangyw
Copy link
Author

@silvia-odwyer

Got it to work, thanks!

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