SVG images aren't accepted as avatars

Be sure to read and follow the guidelines for our forums.

Oct 23, 2014 7:34 pm
I have an SVG file I want to use as my avatar, but the account update page silently ignores it. It's safe to include SVG in an tag - scripts aren't allowed to run and external resources are blocked when loaded through , so you're limited to whatever you can draw within the single file.
Oct 23, 2014 7:49 pm
I never actually considered SVGs for avatars, nor have I worked too much with them (I'm largely a backend dev). Some quick research shows it works just like other image files, so I'll take a look. I've never been great at working with images, so maybe you can recommend something with this.

Right now, when you upload an avatar, regardless of type, its shrunk to fit within 150x150. I did that so people who weren't good with images could use a larger file but it would be scaled down for resources to work well on the site. That being said, an SVG doesn't need to scale the same, as its a vector graphic. I could easily have some CSS set the max-height, max-width for SVGs only and then do the scaling for non-SVG files. Think there's a better solution?
Oct 24, 2014 5:32 am
I just tested, and yeah, setting a max-width and max-height of 150px on the IMG works just fine. That won't have any effect on the raster image's you've pre-shrunk, and it'll ensure that SVGs stay within the prescribed size.
Oct 24, 2014 11:54 am
Alright, until I can find a reason not to, or I find a better solution for, I'll go ahead and add in the code to support SVGs. I'll do some research into the average sizes for an SVG first. I'll post an update once the code is ready.
Oct 25, 2014 4:13 pm
Like, average file size? Depends entirely on whether it's some simple vectors/gradients, or a complicated image converted naively to vectors; file size has no relation to display size. Mine is less than 1k, for example. You can't alter this on your end; you'll just have to reject SVGs over a certain file size.
Nov 12, 2014 3:19 pm
So I need to figure out the validation for SVGs to make sure people don't upload malicious stuff, though I'm not sure it would work in a img tag anyway, but SVGs can now be used as your avatar.

You do not have permission to post in this thread.