Knowledge Base: Including Images in Comments on Posts

When you’re writing a comment on a post and wish to include an image, it can seem puzzling, since the mechanism is entirely different from that used when you add an image to a main post.  Why?  Because the image facility for main posts is a WordPress built-in feature while the comment composition editor is a plug-in by a third party which does not conform to the same interface.  It would be nice if it did, but, not wishing to implement everything from scratch, we work with what’s available.  Once you get used to it, including images in comments isn’t all that painful.  Let’s dig into it.

You insert images in comments by clicking the icon at the right of the comment composition box that looks like a mountain range (that’s supposed to suggest a picture).  When it pops up, you’ll see the following dialogue:

Insert image dialogue

(The icon which summons this dialogue is shown at the top left, subdued.)

In the Source field, you enter the URL of the image you wish to insert.  That’s the Web address whence the image can be accessed.  You can use any image hosting service, but by far the best way is to upload the image to the Ratburger Media Library.  You do this, ideally before beginning to compose the comment (but if you forget, simply open another window, navigate to Ratburger, then use the New/Media item in the menu at the top left), by specifying the image file to upload from your local computer.

After you’ve uploaded the image, its URL at Ratburger will appear in the panel at the right of the window.  Copy it to the clipboard and dismiss the Media Library window.  It will look something like:

https://www.ratburger.org/wp-content/uploads/2017/12/insimg.png

which happens to be the URL for the image above.  That’s what you paste into the Source field of the Insert/edit image box.  The “Image description” field is optional, and specifies the alternative text displayed for users whose browsers cannot display images.  This is particularly important for the blind who use screen reader programs, but this is a courtesy and not a requirement.  The Dimensions will be filled in automatically and needn’t be changed unless you wish to resize the image.

If you upload a very large image (for example, a raw snap from a digital camera which you haven’t resized for use on the Web, the image will be automatically scaled to fit within a 600×600 pixel bounding box.  It is not possible to specify alignment (left, centre, right) of images within comments as one can for images in main posts.

Let me be the first to say that this is less than ideal, but it’s a lot better than what WordPress provides out of the box: no facility for including images in comments whatsoever.

In WordPress/BuddyPress posts and comments on posts have nothing in common with posts and comments in groups.  There is presently no simple way to include images in groups.  That doesn’t mean you can’t include images there, just that you’ll have to know how to type an HTML img tag into your message to embed the image.

8+

Users who have liked this post:

  • avatar
  • avatar
  • avatar

Author: John Walker

Founder of Ratburger.org, Autodesk, Inc., and Marinchip Systems. Author of The Hacker's Diet. Creator of www.fourmilab.ch.

One thought on “Knowledge Base: Including Images in Comments on Posts”

Leave a Reply