Oneboxing large images fails with no visual cue

Running Discourse 3.1.0.beta3 (7c6a8f1c74)

We’re seeing some very odd behaviour with Onebox and PNG / JPG images.

Here’s an image that I’d like to onebox:

It should embed nicely like so:

But instead the image just displays as a link in the post.

Browser console is showing a 404:

Some other examples:

Small PNG:

Large JPG:

Large PNG:

Hmm, it works here.

But it fails on

Lorem Lorem ipsum dolor sit amet, consectetur adipiscing elit - #2 by richrich - general - Discourse Demo

See how the large one isn’t displaying?

Actually, I don’t think it does, the large image hasn’t appeared? :thinking:

I first thought this bug might be due to the file size, our members often post 40MB+ images but I can replicate this issue on using just a 5MB png image.

The image appears in the composer window when composing my post but does not appear in the post itself when submitted.

It also appears in the composer window if I then edit the post:

Here’s a onebox url image to try:

And to test it here on meta, it should appear here:

This bug is present on try and on meta.

The image did appear briefly when I submitted that post but then it disappeared again a few seconds later, I should have done a screen recording. Is it being lost/broken in the baking process? :thinking:

I’ve been poking this bug a bit more.

If I look at a post where the image has failed to be one boxed / pulled down a local copy, when I Edit the post I see this 404 Not Found error in the browser console:

The URL it’s trying to fetch is:

Unsure why it’s throwing a 404, when the image does exist :thinking:

This has worked fine for the last five years, it’s only broken in the last three or four weeks.

1 Like

I’ve been having another run at it today, but I’m afraid I am no closer to working out what’s happening.

When I try and add the it shows in the preview, and in the post for a second, and then is just blank. :person_shrugging:

I don’t see any 404s. I did think it was down to the size, as it was loading line by line in the preview like it was the 90s :slight_smile: But you said you tried with a smaller one and got the same. Which one was that, and I’ll try that one too. :+1:

1 Like

Thanks @JammyDodger

Here’s just a small 5mb image that has the same problem:

And it should appear here:

Which as you say, it does for a second, then it vanishes again.

Yet it’s visible in the composer if I edit the post :thinking: :exploding_head:

I believe it’s removed because the file is too large. By default, the max image size kb is 4096kb, and this specific file is > 5000 kb.

From my understanding, if you upload an image, it’s automatically resized/compressed before sending. You can upload large photos because of the client-side browser optimization.

With download remote images to local setting, Discourse will try to download the image as it is, and if it’s too large, it will be removed from post content.


Hi @Arkshine

Has this default value been changed in the last couple of months?

We have over 1,000 images that are 30-40mb, or higher, which have been pulled remotely for many many years without an issue :thinking:

Sorry @Arkshine I’ve looked in to this again this morning as I may have misunderstood your message earlier.

We changed our setting a number of years ago to allow images of up to 100MB in size.

I’ve been trying to trace exactly when this broke and I can narrow it down to roughly some point after 3rd March 2023.

Here’s a 35MB image that was working on 3rd March 2023:

And a 27.3MB example from the same date in March:

And a 11mb example from 27th February:

I might have a wade through the commits made in the last six weeks or so and see if any of the commit messages jump out at me :slight_smile:

1 Like

The raw content for this specific post (and the one below) on your forum shows that it is an uploaded image, not an external link. Because of Client side image optimization enabled by default, you will be able to upload large images.

Your initial issue is about inserting an external image link.
That said, I’m unsure if Discourse behavior is expected not checking the image size when pasting an image link. :thinking:

Can you share the value of upload_size in your app.yml?

Hey Richie!

I don’t know about Discourse being able to download very large remote images.

However, I remember that previously, when you hotlinked a large image, it displayed a message like “This image is too large to be displayed in the forum”, with a link to the external picture.

It seems it doesn’t happen anymore.

Pasting an external, large image link ( - 11 MB GIF) , I can repro your issue:

It looks very much like a bug and possibly a regression.

1 Like

I think you may have misunderstood the issue, or maybe you are seeing the cause of the bug :thinking:

I did not upload that image to Discourse, I just pasted a link, exactly like @Canapin 's screen recording below :blush:

It’s been pulling large images for years now @Canapin mate, many years, it’s only stopped working in the last six or eight weeks.

Thanks for testing :+1:

I can replicate it on our forum, on and on

I’ve placed a bounty on the issue:

Thanks again to everyone who has looked at this issue so far :bowing_man:

i was able to reproduce this issue as well. i also went through all my image related settings to make sure nothing there was somehow causing the effect. i notice when i first make the post with large image link, it flashes for a minute like it’s going to load from the top of the photo, then just disappears (this despite the image being very visible in the post preview window).


Thanks @Lilly that’s exactly the issue we’re seeing too.

1 Like

i just tested in private messages and the image shows up fine as expected and links to the original. so the issue is strictly in topic posting views it appears.

@Richie cool photos btw :slightly_smiling_face:


FWIW I’ve just given that a test, but mine disappeared in the PM as well.



here is my pm view:

getting same issue in desktop and mobile views too.