11
$\begingroup$

What is the best way to include graphics in a question or an answer on MO?

I searched the help but could not find instructions about how to post graphics. I also looked at a couple of Joseph O'Rourke's posts but I was too stupid to be able to figure out how he did it.

Also I am wondering if some methods are more "universal" than others. Occasionally some MO answer will contain a graphic that I cannot see on my work computer, probably because of various filters that have been installed for security (blocking Java and Flash for example, as well as content from "untrusted" websites).

$\endgroup$

2 Answers 2

10
$\begingroup$

Put a line of the form

![Text to be shown if the picture is unavailable][1]

at the place in your post where the graphics should appear, put the graphics online on a website you have write access to, and add a line of the form

[1]: http://www.url-of-your-picture.edu

at the bottom of your post.

If you want to improve your graphics some time later, you simply do this on the website where you have put it -- there is no need to edit your post on MO for this.

$\endgroup$
7
  • 2
    $\begingroup$ Just a minor addendum: "Put a line of the form..." This can be accomplished by clicking on the Image icon among the editing options (B, I, etc.). $\endgroup$ Commented Sep 23, 2014 at 1:30
  • 6
    $\begingroup$ Another not so minor addendum: rather than putting it on a random website which might or might not continue to host it later, it’s better to put it on the stackexchange imgur account (which I believe the image icon will suggest automatically). See blog.stackoverflow.com/2010/08/new-image-upload-support . $\endgroup$ Commented Sep 23, 2014 at 11:14
  • $\begingroup$ @EmilJeřábek: If hosting images on imgur is preferred over hosting them on other websites, I think copying images over to imgur by a script is straightforward. $\endgroup$
    – Stefan Kohl Mod
    Commented Sep 23, 2014 at 20:44
  • 2
    $\begingroup$ I don’t think there is much point in mass moving images that are already hosted elsewhere. What I mainly wanted to stress is that the process is easier than what your answer suggests. If the image is already available online, fine, just insert the image link. But if it is not, one needn’t go to pains of looking for an external site to host it (which might be nontrivial for some users). One can just click on the image icon and directly upload the image from local computer to the default site. $\endgroup$ Commented Sep 23, 2014 at 21:32
  • $\begingroup$ Better yet: instead of url-of-your-picture.edu, use yourdomain.com/blah, where yourdomain.com is the name of a domain that you own. That way, if the hosting site ever disappears, you can move your files elsewhere, repoint yourdomain.com, and not have to edit the MO post. $\endgroup$ Commented Sep 25, 2014 at 23:56
  • 2
    $\begingroup$ The problem with imgur for me is that the attention-distraction advertizements are also located there and thus I've usually a filter against this. So I'm thinking to return to the practice of putting my images on my own webspace so that at least for my own contributions and images I don't have to switch on/off my filters. $\endgroup$ Commented Oct 7, 2014 at 10:10
  • $\begingroup$ @GottfriedHelms: That's a good point. -- Hosting valuable content on an ad server is probably not a good choice. $\endgroup$
    – Stefan Kohl Mod
    Commented Oct 7, 2014 at 10:18
5
$\begingroup$

Permit me to mention one variation, now that my name has been invoked. :-)

In the question "Random points on the unit sphere," I included an image just as Stefan describes. But it was, I felt, much too large for the rather minor effect I wanted to achieve. So after the StackExchange software created the [1]: ... line, I copied the image URL and then pasted it into an explicit img-tag whose dimensions I could control: <img src="https://i.sstatic.net/Srn9r.jpg" width="300" />:


         
Without that intervention, this is how it would have displayed:
         
Concerning

I am wondering if some methods are more "universal" than others.

Images displayed by browsers should be in one of three formats: .jpg, .gif, .png. In particular, you should not use .pdf.

$\endgroup$
7
  • 1
    $\begingroup$ Thanks. By the way, this is a good example of a graphic that I cannot see on my work computer, presumably because i.stack.imgur.com is not a "trusted" website. I can see some other images, e.g., "Light reflecting off Christmas tree balls." $\endgroup$ Commented Sep 23, 2014 at 18:46
  • 4
    $\begingroup$ @TimothyChow: That's a new one to me, the trusted website issue. The reason you can see my Christmas tree balls is that image is stored on my college's website. You might consider loosening the security settings to permit i.stack.imgur.com, which is (frankly) more stable than my own website. And if you know of specific security risks, you should inform the StackExchange team. $\endgroup$ Commented Sep 23, 2014 at 19:45
  • 8
    $\begingroup$ You could have achieved the same effect by changing the provided URL to https://i.sstatic.net/Srn9r.jpg?s=300. This would also mean that browsers would have downloaded a smaller image, rather than downloading the big one and scaling down themselves. $\endgroup$
    – TRiG
    Commented Sep 23, 2014 at 22:16
  • $\begingroup$ Most browsers do support other image formats, but it varies. en.wikipedia.org/wiki/…. The three you mention are indeed the most common. $\endgroup$
    – TRiG
    Commented Sep 23, 2014 at 22:21
  • $\begingroup$ @TRiG: Cool! I didn't know that option. Thanks! $\endgroup$ Commented Sep 23, 2014 at 23:25
  • 1
    $\begingroup$ Well, 300 on your monitor may be different than 300 on mine. $\endgroup$ Commented Sep 25, 2014 at 19:01
  • $\begingroup$ @JosephO'Rourke: Perhaps you should roll-back your second revision, "Followed TRiG's advice", as it no longer appears to work. Alternatively, you can add an "m" suffix to reduce your (nearly) square 464x463 image to 320x320; see e.g. superuser.com/questions/1238552/…. $\endgroup$
    – jeq
    Commented Apr 29, 2020 at 20:55

You must log in to answer this question.

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