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: https://dronescene.co.uk/images/uploads/fullsize/20211216142548_DJI_0205_HDR_Pano.png

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:

https://dronescene.co.uk/images/uploads/fullsize/20211106095005_vlcsnap_2021_05_04_17h10m24s149.png


Large JPG:

https://dronescene.co.uk/images/uploads/fullsize/20230227161106_DJI_0087_1.jpg

Large PNG:

https://dronescene.co.uk/images/uploads/fullsize/20220103215207_IMG_5782.png

Hmm, it works here.

But it fails on try.discourse.org

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 try.discourse.org 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:

https://dronescene.co.uk/images/uploads/fullsize/20230329003455_Screenshot_2023_03_29_at_00.23.31.png

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:

https://greyarro.ws/onebox?url=https%3A%2F%2Fdronescene.co.uk%2Fimages%2Fuploads%2Ffullsize%2F20230411071449_8719D92D_726A_46BF_9437_A06DD0507D77.jpeg&refresh=true&category_id=17&topic_id=61425

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

https://dronescene.co.uk/images/uploads/fullsize/20230411071449_8719D92D_726A_46BF_9437_A06DD0507D77.jpeg

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 https://dronescene.co.uk/images/uploads/fullsize/20211216142548_DJI_0205_HDR_Pano.png 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: https://dronescene.co.uk/images/uploads/fullsize/20230329003455_Screenshot_2023_03_29_at_00.23.31.png

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.

3 Likes

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:

https://dronescene.co.uk/images/uploads/fullsize/20230303120013_DJI_0013.jpg

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

https://dronescene.co.uk/images/uploads/fullsize/20230303120713_DJI_0055.jpg

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 (https://upload.wikimedia.org/wikipedia/commons/0/0b/New_cyclic_large.gif - 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 try.discourse.org and on meta.discourse.org

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).

2 Likes

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:

2 Likes

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

2 Likes

weird

here is my pm view:

getting same issue in desktop and mobile views too.