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

Add an 'X' button to the rescaled image link for easier navigation #12812

Open
lSabrinel opened this issue Aug 22, 2024 · 5 comments
Open

Add an 'X' button to the rescaled image link for easier navigation #12812

lSabrinel opened this issue Aug 22, 2024 · 5 comments
Labels
type:proposal a feature suggestion

Comments

@lSabrinel
Copy link

lSabrinel commented Aug 22, 2024

Observation:
A rescaled image in a Sphinx project links to the full-size image, which is useful, but returning to the previous page is a bit inconvenient.

Improvement:
I suggest adding a small 'X' button to close the image and return to the page.

Workaround:
For now, I am working on overriding the CSS to create the button.

Behavior:
I apologize that I can't show you the real project I am working on, but this is a sample project.
The image behavior is the same.
When you click on the image, it directs you to the link shown below.

2024-08-23-10-35-20.mp4

Code:
.. image:: ../../source/_static/images/car1.jpg :scale: 80%

@lSabrinel lSabrinel added the type:proposal a feature suggestion label Aug 22, 2024
@lSabrinel lSabrinel changed the title <Add an 'X' button to the scaled image links for easier navigation> Add an 'X' button to the scaled image links for easier navigation Aug 22, 2024
@electric-coder
Copy link

Can you edit the question to include a minimal reproducible example?

It seems I have lots of images in my project but none of them are by themselves clickable, so I want to know exactly how you include such an image.

@lSabrinel lSabrinel changed the title Add an 'X' button to the scaled image links for easier navigation Add an 'X' button to the rescaled image links for easier navigation Aug 23, 2024
@lSabrinel
Copy link
Author

Hello @electric-coder,
I have edited the question to include a short video showing the image behavior, as well as the Sphinx directive and its rescale option.

@lSabrinel lSabrinel changed the title Add an 'X' button to the rescaled image links for easier navigation Add an 'X' button to the rescaled image link for easier navigation Aug 23, 2024
@electric-coder
Copy link

electric-coder commented Aug 23, 2024

@lSabrinel I understand the problem you describe now. I haven't searched previous Sphinx issues for a solution, nor SO's python-sphinx tag but there might already be an extension that adds the "back" functionality for the image.

@SilverRainZ
Copy link
Contributor

Have you tried https://sphinxcontrib-images.readthedocs.io/en/latest/?

@lSabrinel
Copy link
Author

Hello @electric-coder indeed there is a solution, and the key is to use the sphinxcontrib-images extension and the Thumbnail directive.
Thanks to @SilverRainZ , who pointed out the solution. It worked as intended and even offers additional interesting options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:proposal a feature suggestion
Projects
None yet
Development

No branches or pull requests

3 participants