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

Added support for image title from alt attribute #1766

Closed
wants to merge 5 commits into from

Conversation

brunogrcsada
Copy link
Contributor

Any text in an image's alt tag is taken and presented as the title...

Example:

<div>
     <a class="meep" href="https://cdn.photoswipe.com/photoswipe-demo-images/photos/6/img-2500.jpg"
	    data-pswp-width="2500" 
	    data-pswp-height="1667"
	    target="_blank">

	    <img src="https://cdn.photoswipe.com/photoswipe-demo-images/photos/6/img-200.jpg" 
                  alt="Beautiful beautiful Image" />
     </a>
</div>

Peek 2021-06-24 10-30

@brunogrcsada
Copy link
Contributor Author

I'm going to add a visibility check for the counter indicator, otherwise the title overlaps on the left when there are multiple images...

@dimsemenov dimsemenov changed the title Added support for image title from alt tag Added support for image title from alt attribute Jun 27, 2021
@dimsemenov
Copy link
Owner

I don't really want to include a caption module into the core, as it's very hard to create a versatile solution - some captions are long, some captions have links, some captions need to be scrollable etc.

You may create a separate repository with just a caption module, and I'll link to it. Or this pull request itself will help someone for sure.

uiRegister event will help hook a module in https://photoswipe.com/v5/docs/caption/

@brunogrcsada
Copy link
Contributor Author

brunogrcsada commented Jun 28, 2021

No worries at all @dimsemenov, I just thought that quite a few people would find this useful; I definitely see where we could encounter some problems with making the caption implementation versatile. I'll continuing improving this; the caption div currently has an ellipsis text overflow, and I can test this more to ensure that different caption lengths are displayed properly :)

@dangelion
Copy link

dangelion commented Jul 7, 2021

@dimsemenov When you think you'll release it?

@brunogrcsada If caption is a long term implementation, you could make a separated PR just for the Warning issue? 4944ac8

Thanks

@acwolff
Copy link

acwolff commented Jul 7, 2021

No worries at all @dimsemenov, I just thought that quite a few people would find this useful;

I don't agree with this statement, most people do find it useful,
I had a flexible solution with the previous Photoswipe version, see this jAlbum test page.

@robsonsobral
Copy link

Hi, everybody.

The alt attribute isn't a caption or a title. Maybe you should think on an alternative.

@dimsemenov
Copy link
Owner

There's caption plugin now https://github.com/dimsemenov/photoswipe-dynamic-caption-plugin

Feel free to fork or create a simpler version.

@dimsemenov dimsemenov closed this Mar 14, 2022
@acwolff
Copy link

acwolff commented Mar 14, 2022

When can I expect an update of the caption plugin?

@dimsemenov
Copy link
Owner

@acwolff for now the only caption plugin that I maintain is https://github.com/dimsemenov/photoswipe-dynamic-caption-plugin , I might make another one, a much simpler one (based on the Caption section of docs).

@acwolff
Copy link

acwolff commented Mar 14, 2022

Yes, that is the caption I am using (see https://andrewolff.jalbum.net/PS_Samples_AA/).
That caption plugin contains some problems, that is the reason that I ask for an update.

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

Successfully merging this pull request may close these issues.

None yet

5 participants