-17

It bothers me that, whenever I click on an image inside a post, I get redirected to the site where the image is hosted (Imgur in this case). Can we make it so images are shown as an overlay in the existing page? So I can easily go back to the post by closing the image or by pressing Esc?

If you are familiar with Jira that's the exact same feature I'm after.

EDIT: For clarification I mean bigger res images, like screenshots

5
  • 8
    Images shown here as link rarely contribute for question quality, so no. Commented Dec 15, 2022 at 15:30
  • 4
    Why would pressing esc be more convenient than pressing backspace to get back to the previous page? Commented Dec 15, 2022 at 15:49
  • 3
    Lots of even low-end mice (including non-gaming mice) also have buttons that happen to be intercepted as back/forward by browsers. I fail to see why it's a problem Commented Dec 15, 2022 at 16:23
  • 6
    Images are commonly, but not always, written in Markdown such that the image is also a link. Thus, clicking on the image will typically navigate the page, or you can open a new tab with just the image. While I can understand wanting a popup with just the image, there are numerous options as to how that could be made to work. Not everyone will want such a popup. This seems like it's something that's better handled by the user installing one of at least several different available browser extensions which provide such popups for images.
    – Makyen Mod
    Commented Dec 15, 2022 at 17:22
  • This post appears to have been trying to ask for lightbox-style viewing of already inlined images, while it was interpreted by many people as asking for overlaying viewing of image links. Thus, the voting and answers appear to be a mix of those, and it's impossible to get a clear signal of which interpretation people were voting on. The request has recently been re-asked more clearly, so I'm pointing this one to that new request.
    – Ryan M Mod
    Commented Oct 1 at 7:23

2 Answers 2

8

Images can be inlined in posts:

The syntax for this is to put an exclamation mark (!) before an ordinary Markdown link:

![](https://meta.stackoverflow.com/Content/Img/unifiedmeta/sprites.svg)

This is explained in the formatting help. HTML <img> tags should also work.

To my understanding, new users have this functionality deliberately disabled, although other users can edit it back in to the post. This is because very few things should be images in Stack Overflow posts, and new users are prone to misusing images. We generally want text, because we are programmers doing programming, not discussion-forum users having a discussion.

Having images show up in an overlay (a JavaScript-powered image viewer that disappears on click) or while mousing over the link, etc. etc. would be the worst of all possible worlds. For the few cases where images are appropriate, I see no good reason not to include them inline.

1
  • 3
    Inline images are disabled for low rep users primarily to prevent their use in spam and abusive posts.
    – PM 2Ring
    Commented Dec 15, 2022 at 23:48
5

There's a userscript that accomplishes what you appear to be after, written by @Samuel Liew, called Lightbox Images.

As the name implies, it lightboxes (most) images on click, and then closes the lightbox on either click or esc press.

Demo:

Lightbox image behavior demo

Not the answer you're looking for? Browse other questions tagged .