Hacker News new | ask | show | jobs
by earlybike 3178 days ago
Nice idea. As one wrote, this can easily done with one line of JS but having this as an web API which returns an image file is definitely neat.

However, I see a privacy issue with sending all my user's real names to some 3rd party service (even if they claim there's no tracking or something similar).

4 comments

Absolutely, I'd probably also just use CSS and HTML and use the core package: https://github.com/lasserafn/php-initials to generate the initials, it's faster and you won't depend on third-party.

I absolutely see your point, that's also why I open-sourced the code (see footer), but obviously I could be using different code or track it on the server (nginx or similar?). This is not the case, but I understand. Another option is to use the core generator (which is also open sourced) so that the generation happens locally :) But then again, CSS+HTML does not require any generation

Why don't you rather provide a service which generates more complex avatars such as those from Github[1] or Slack.

Your API consumer sends some unique string (user-id, hashed user-id or hashed username or whatever they like) and you send back an unique avatar for that string. Moreover, you as the API provider offer different themes (e.g. tablecoth, space invaders, pixel-faces, etc.) which the consumer can again slightly customize (e.g. color, size, etc.) to have a unique style over all its avatars.

You current solution is elegant but at the same time just too easy to build oneself.

[1] There was a code golf competition on SE, maybe useful in this context: https://codegolf.stackexchange.com/questions/82290/generate-...

I built this service (or, the core GitHub package) because we needed it internally, and someone requested an API of this, so I quickly threw together this :-).

Also, I think theres a lot of those unique avatar generators out there (even one in the comments here), and I like them but they're not personal like your initials are. Also, for example, in accounting software (where I needed it internally) a monster or space invaders didn't fit with the audience.

I do however like your idea! Wouldn't be hard do create either. Who knows, that could be version 2

I think the key challenge with my proposed idea is to have another internal API just for the themes. Everybody can provide themes for the service and hook them into the main avatar service.

Imagine there would we just one avatar service where consumers can get thousands of different avatar-styles.

Didn't consider that aspect. That would be very cool! Okay, thats a little more of a challenge than generating some initials and making a circle, lol. I will investigate, sadly I'm not the most creative person, so wouldn't be as cool as https://robohash.org
It won't be if you only send the first letter of the first and last name.
If you use only the initials, you can cut or fake the other letters since they're ignored anyway. Not 100% privacy but better than sending the full name
Yes and true but this already half of the API. The rest is just the CSS for the rounded box and color.
Solid points :D Sadly theres not much I can do (I think?) to make people believe that there is privacy.

I guess generating them locally (or using CSS) would be the best option for anyone concerned with privacy

That was the approach I took to same probelm for users on an annotation service.

This seems nice but still overkill.

Yeah, it absolutely is (ui-avatars). I think its a neat little think to act as fallback for gravatar, but I totally agree that it's overkill