Skip to content

Downloading an image that was loaded via the Item content attribute #1076

Answered by akhmadullin
mattbarnicle asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, you're right.

Download button works only with images, that were rendered via photoswipe (<Item original="img.jpg" />).

Item's content prop was implemented to provide users with an opportunity to open in Photoswipe content, different from simple image - Google maps, for example. That's why download button works only with 'native' Photoswipe images.

I can assume, that you have some knowledge about which image is opened right now in Photoswipe via your custom component (let it be CustomImage component), that you pass to Item (<Item content={<CustomImage} />). If you have such knowledge, you can implement your own download button:

const customDownloadButton = {
  name: 'custom-download-b…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@mattbarnicle
Comment options

@akhmadullin
Comment options

Answer selected by mattbarnicle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants