|
|
|
|
|
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 |
|
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-...