Hacker News new | ask | show | jobs
by Camillo 4688 days ago
It's going to be great when users post APNGs with a first 1/30s frame that shows Mickey Mouse's face and a second permanent frame that shows hardcore porn. And your moderator uses a browser that doesn't support APNG, so they just see the innocuous frame and have no idea about the rest.

Automatic fallback to a normal static PNG is a terrible idea. If you want an animation format, give it its own extension and MIME type. The only reason why it works for GIF is that it's basically assumed to be animated nowadays, and it started out with animation support (as far as the web is concerned).

2 comments

You can already do things like that with gamma. To say nothing of embeds allowing file substitution.

I don't see why fallback is bad. Having a single canonical file is so much nicer than multiple files. APNG has been around for ages. If you as an upload-accepting web dev aren't aware of it you're not a very good web dev. And as a user you don't even know what container an image is using 99% of the time, so MIME type doesn't matter. Browsers tend to ignore image MIME anyway because of how common mislabelings are.

I used to run and code an image posting site. It took me all of half an hour to add a feature to the admin section that showed every frame of an animated image when posted using the image magick library from PHP. So this isn't a particularly difficult problem from a moderation perspective. Silent bans and contagious bans took a lot more coding (banning someone such that they don't know their posts are no longer visible, and banning someone automatically if they've posted a banned image or have a cookie from a pervious ban, etc..).

I hate APNG personally, though, because I think MNG makes a lot more sense. The server can return what is appropriate based on standard HTTP content negotiation with that. APNG is just a stupid hack and the only reason Mozilla went with it instead of MNG is because is saves 100KB in the browser binary, which I couldn't care less about.