Hacker News new | ask | show | jobs
by lasserafn 3178 days ago
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

1 comments

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