Very large gifs should be shown as previews

Guys from my forum likes to post big gifs in “fun pictures” topic. It pisses me off because they weight a lot and page loads forever. I think it’s a good idea to show gifs as a previews and when you click on some picture - ajax it. I’ve seen this feature on vk.com and I rly liked this idea.

P.S. Testy test:

http://img0.joyreactor.cc/pics/post/%D0%B3%D0%B8%D1%84%D0%BA%D0%B8-superjail-%D0%BC%D1%83%D0%BB%D1%8C%D1%82%D1%81%D0%B5%D1%80%D0%B8%D0%B0%D0%BB-%D0%A1%D0%B2%D0%BE%D1%8F-%D0%B0%D1%82%D0%BC%D0%BE%D1%81%D1%84%D0%B5%D1%80%D0%B0-1886210.gif

EDIT

huge image removed from OP cause 32MB will blow peoples mobile plan.

2 Likes

Related feature request - MP4’s end up being smaller:

3 Likes

In the interim, it might be a good idea to have the lightboxer hide images based on file size as well as dimensions. Especially if they’re animated GIFs.

For some reason, Chrome reacts very, very badly to images like these and becomes almost unusable until the image has finished loading. (This isn’t specific to Discourse, however.)

1 Like

Its odd, sometimes this gif totally messes up chrome on windows and sometimes it does nothing, really feels like a chrome bug to me.

My preferred solution here is simple to render a blank div where there are images as soon as an image is not in the browsers view. We already pull posts out and replace with blank divs when you load too much, but this would take it to the next level

3 Likes

I thought at one point animated gifs were click to play above a specific size?

I remember when an capturing animated of a bug for meta I had to make sure it was below a specific size I think it was something like <460 x <500 to ensure it would play automatically.

Pretty sure @zogstrip has commented on this before.

It’s above a specific resolution, but not a specific filesize.

Is the size even checked when the file is externally hosted?

Well yeah, the posting of

THIRTY

ONE

MEGABYTE

gifs should probably be frowned upon. Here’s the video version that imgur created automagically for me at http://imgur.com/uelnPvv

it’s a 1.93 mb .webm file:

General
Format                         : WebM
Format version                 : Version 2
File size                      : 1.94 MiB
Duration                       : 11s 400ms
Overall bit rate               : 1 427 Kbps
Writing application            : Lavf55.48.100
Writing library                : Lavf55.48.100

Video
ID                             : 1
Format                         : VP8
Codec ID                       : V_VP8
Duration                       : 11s 400ms
Bit rate                       : 1 364 Kbps
Width                          : 640 pixels
Height                         : 374 pixels
Display aspect ratio           : 1.711
Frame rate mode                : Constant
Frame rate                     : 25.000 fps
Compression mode               : Lossy
Bits/(Pixel*Frame)             : 0.228
Stream size                    : 1.85 MiB (96%)
Default                        : Yes
Forced                         : No

Perhaps ask your users to host somewhere that large GIFs are converted to videos…

2 Likes

This means make users reposting all the time. Sinse there’s no automatic service for this yet that Discourse could use, maybe you guys can add a spoiler shortcode that loads content only when you open it? Then admins could just add a forum rule “post big gifs only in spoilers”. We need spoiler code anyway for topics with movies discrussions.

It’s interesting that different browsers handle this fine…

Use case is: 31 megabyte animated gif, served from slow host. Same URL as in first post. Results?

Google Chrome: cripples browser perf during load, intermittently shows animation frames. Performance is at a crawl, to do anything in the browser is painfully slow.

Firefox: browser seems OK during load, shows animation frames at a decent clip as it loads. Performance seems OK, you can do anything while the image is loading.

IE: browser seems OK during load, shows animations at a rapid clip as it loads. Performance seems OK, you can do anything while the image is loading.

So this does seem to be a bit of a Chrome specific problem.

1 Like

Looks like this issue is fixed in Version 43.0.2329.0 canary (64-bit)

no lag, stuff seems smooth as butter

3 Likes

Have you did something with big gifs already? That 31 Mb gif on my forum shows as link now. But other gifs for like a 10 Mb still shows as gifs.

Also, @codinghorror, how do you convert a gif to a video via imgur?

I reccomend https://gfycat.com/

It’s like a default on many subreddits, since it’s the most used gif service.

1 Like

Well, it doesn’t embeds so I don’t see much profit from this.

It would be nice to have a checkbox somewhere in admin panel that would make all gifs to show as links. This would solve this problem, not pretty way, but solid way for sure.

If you right click and hit “Copy video url:”


And paste that, it embeds it:

http://fat.gfycat.com/AggressiveClosedEstuarinecrocodile.webm

It would be nice if this was done automatically. Maybe the video plays when the poster reaches the post too.

EDIT: In fact, gfycat has an api to convert GIFs to MP4. Might not be such a bad option to have this happen automatically. I bet a plugin could be made for this.

1 Like

Got it. Testing upload to imgur:


Hmmm… looks exactly the same. And why does it stratched? Discourse did this or some other thing that Discourse uses to embed stuff?


Fixed it on my forum via CSS.

.topic-body video {
    height: auto !important;
    width: auto !important;
}

Hey, I just realized that gfycat have API and it’s possible to send all gifs from post to their service and change them into video-links automatically.
https://gfycat.com/api
@sam @eviltrout @codinghorror Can you take a look?

The first line of that document tells me their platform is not ready to be used that way:

While Gfycat does not yet have a full fledged API with access credentials and advanced access control, the core features are exposed through easy to use JSON endpoints.

It seems risky to use an API that is not stable.

3 Likes

There is no need to @ mention me on anything really, I read every post on this site.

5 Likes

My thoughts on gfycat from the other thread:

IMVHO on-the-fly conversion that requires interaction with third party service (gfycat) should be an external plugin or a custom JS.

But I think that default Discourse install could easily ship with automatic onebox for already existing Gfycat links, just like it already does for GIFV from Imgur.

So this:

http://gfycat.com/AggressiveClosedEstuarinecrocodile

could be easily oneboxed into a looped <video> tag with mp4/webm sources:

<video autoplay="autoplay" muted="muted" preload="auto" loop="loop"  poster="//thumbs.gfycat.com/AggressiveClosedEstuarinecrocodile-poster.jpg">
    <source src="//fat.gfycat.com/AggressiveClosedEstuarinecrocodile.webm" type="video/webm">
    <source src="//fat.gfycat.com/AggressiveClosedEstuarinecrocodile.mp4" type="video/mp4">
</video>
2 Likes