New Composer Issue: Linked Images

Hello! Well, I tried enabling the rich text composer on my site, unfortunately I have experienced a few issues with it… The first and foremost is that linking to images, as you would in the regular Markdown editor, doesn’t appear to work in the rich text composer. For example:

![Test image.](https://live.staticflickr.com/65535/54637302974_542eb17306_3k.jpg)

In the regular Markdown editor, that would of course result in an inline image being displayed in the post. As you can perhaps see here, that is not the case with the rich text composer!

1 Like

Are you writing out the markdown in the rich text composer?
If so, that’s not going to work, you can’t write markdown in the rich composer.

Or are you pasting/uploading the image?
That works normally.

… I can see why you’d write it out - I don’t think the rich composer has a way to tell it “link to this external image”?

Hello, my apologies for not specifying, I was indeed writing it out in the rich text editor! Unfortunately that was the only was of linking to an external image without turning it back off again, at least that I could see :frowning:

1 Like

If this should be a feature request rather than a bug (I was technically using the rich text editor improperly), please feel free to move it to the appropriate category! I would say that linking to external images is a fairly common use case, so having a button in the rich text editor that can link to external media might be a good future addition, but from a very technical sense the composer is working properly in this case. :slight_smile: It perhaps just needs an extra button or two!

1 Like

Absolutely; I think this ultimately is a feature gap problem but I’ll let the feature owner decide how exactly to classify it further.

1 Like

Thanks very much, I will do the same. My apologies for the misclassification :slight_smile:

You can post an image URL on a new line and it will onebox for you:


However, this lacks the resize/captioning controls that directly uploading an image gives. Not sure what @renato thinks of this use case, I know for other types of onebox we consider them a special case, so not sure if image resizing/captioning can be added here.

1 Like

The same problem exists in the markdown composer; maybe we can extend the Insert Link button to support this.

Or, what do users expect to be able to do to to upload an image?

1 Like

I think there’s potential for something else, like supporting a way to insert external images via a specific UI, as you mentioned. I know it’s a stretch, but I’ve seen elsewhere the emoji action with tabs to search for GIFs or input external media, we could do something to improve this – it’s just not clear yet what exactly.

However, we do support some special input rules that make typing in the new editor familiar for people used to Markdown, like # titles or **bold**, so I’ve also added it for a ![image](markdown) format:

It’ll allow you to type ![Test image](, paste a link, type ), and have yourself an image node.

3 Likes

This works quite well though, I appreciate the suggestion! Generally, when linking to an external image in Markdown (in the old composer), the image resize/captioning controls are not shown unless the image is automatically downloaded/mirrorred by Discourse. Since I have that option turned off (I need to save space badly :slight_smile: ), the controls are not shown anyway, so as long as the image is appropriately scaled and maintains its aspect ratio, this solution you have posted works great.

I think, from a user’s perspective, I only expect to be able to do two things with an image…one is to display it of course, but the other is to be able to provide alternative text or a tooltip for accessibility purposes (e.g. so that blind users are told more than that there is a random image on the page). The scaling and aspect ratio seems to be handled quite well already, so maybe if there was just a button that allowed you to insert an external image, without having to switch into the raw Markdown editor. I think the new composer is great now that I’ve given it more time and gotten used to how it works, but unfortunately at the moment, I have to turn it off for my particular use case anyway. As such I just leave it off, but I recognize the value of the new composer for newer users as well. I look forward to being able to enable it permanently :slight_smile:

This sounds like a great idea as well, much appreciated!

FYI the behind the scenes answer is the controls are only shown when the image size is specified in the markdown, e.g.:

<!-- shown -->
![caption|690x432](upload://8oFjMj2KPpS6hKmiXRIImrFw22L)
![caption|690x432,50%](upload://8oFjMj2KPpS6hKmiXRIImrFw22L)

<!-- not shown -->
![caption](upload://8oFjMj2KPpS6hKmiXRIImrFw22L)

(it would be great if the client could put those in automagically; normally it’s only done at image fetch time)

1 Like

Ahh I see! Thanks for clearing that up :slight_smile: I am not very familiar with the internals for these things, at least not yet! Great to know though, perhaps I can use this to add the controls to my cloud-hosted images as well!

1 Like

Funny you said that, that’s exactly what the rich editor now does (the PR is merged) when an image doesn’t have dimensions :smiling_face:

It won’t auto-update the document (we avoid that in general), but it will show the controls and auto-calculate the dimensions if you use the scale buttons.

2 Likes

I ran my updates for the day and was surprised to see that this update has already been included…I wanted to post as an update that I flicked the setting for the rich text editor back on to give it a try, it works exactly as I’d expect it to, so thanks very much for that! At this stage the only issue that I had with the new composer has been fixed, so to speak :slight_smile: The other “issues” I noticed I won’t post bugs about, as I couldn’t reproduce any of them…I’m more convinced that (at the time) I was having some sort of networking/routing issue than there being problems with the new composer. That’s for me to sort out :slight_smile: I’ll keep the new composer enabled on my site for now, I like the fact that the rich text editor adds the caption visually to the picture as well!

1 Like