Git Product home page Git Product logo

ui-avatars's Introduction

Code for https://ui-avatars.com

Sponsors

TellusDB Country Data API

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

Contributors

This project exists thanks to all the people who contribute.

Backers

Thank you to all our backers! 🙏 [Become a backer]

ui-avatars's People

Contributors

coliff avatar d2s avatar g0turkoglu avatar lasserafn avatar lukebrewerton avatar monkeywithacupcake avatar stof avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ui-avatars's Issues

CORS Issue from Javascript

For whatever reason, when calling the code below from my localhost I cannot for the life of me get anything back other than a CORS response error. Is there something wrong on my side?

Thanks

var url = "https://ui-avatars.com/api/?name=John+Doe";
  let response = await fetch(url);
  let data = await response.json();

[Content] Projects page (Users of, and built with)

Add two new sections:

Built with

Should contain links and descriptions to projects that make use of the api

Cases

Should contain links and screenshots from users of the projects. I will probably have to ask around or add some submit button. Maybe just accept pull requests?

So far, using Google Images and Search Console has led me to find a few already.

Already discovered:

  • geartester.de

SameSite attribute issue

Hello, we have a warning in our console, that soon google chrome will break your library. Could you please fix that? Warning is below, please take a look:

A cookie associated with a cross-site resource at was set without the SameSite attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with SameSite=None and Secure. You can review cookies in developer tools under Application>Storage>Cookies and see more details at and .

Gravatar strips the spaces in the name from default URL

It would seem that Gravatar strips any (encoded) spaces from the default URL (?d=DEFAULT_IMAGE_URL) breaking the expected image result.

Using the example from the README:

curl -I "https://www.gravatar.com/avatar/EMAIL_MD5?d=https%3A%2F%2Fui-avatars.com%2Fapi%2F/Lasse+Rafn/128"

HTTP/2 302
server: nginx
date: Thu, 04 Mar 2021 14:55:06 GMT
content-type: text/html; charset=utf-8
content-length: 0
location: https://i2.wp.com/ui-avatars.com/api//LasseRafn/128?ssl=1
last-modified: Wed, 11 Jan 1984 08:00:00 GMT
link: <https://www.gravatar.com/avatar/EMAIL_MD5?d=https%3A%2F%2Fui-avatars.com%2Fapi%2F/Lasse+Rafn/128>; rel="canonical"

CleanShot 2021-03-04 at 15 57 30@2x

Is there any way to encode first and last names separately in the URL path components so as not to loose the spaces?

(Awesome service BTW!)

First load error

Before everything works perfectly then suddenly this error occurred.
When I tried to load the image for the first time this error show's up
Then tried to refresh the page the image is now showing.
Image: https://ui-avatars.com/api/?name=Favorite%20Group&size=128

"This page contains the following errors:
error on line 2 at column 1: Extra content at the end of the document
Below is a rendering of the page up to the first error."

Platform Info:
Browser: Version 88.0.4324.96 (Official Build) (64-bit)
OS: Linux Ubuntu 20.04

Issue with MS Edge

There is a weird behaviour in MS Edge, The image shifted to the top, any ideas ? Thanks!

Screenshot from 2019-10-21 20-49-18

Custom font name when requesting .svg

It would be nice to set a custom font family name when requesting .svg. I have a custom font loaded in my React Native app, so if I could pass the font family name in the URL itself then the resulting SVG will use the same font as my app.

Feature: Support Alpha channel in colours

Hi there,

it would be great to have the option to pass in a background or a text colour that supports alpha channels with the RGBA format #RRGGBBAA or #RGBA, e.g.

https://ui-avatars.com/api/?background=a0a0a00f

The nice thing about beeing able to set an alpha channel, is that it can also be set to a semi transparent level, not just fully transparent or fully visible.

Btw: The url with the 8 digit colour code currently results in a broken 0x0 pixel image.

Cheers

Serving the API response as per (SERVER+filename.png)

I saw this line
acedac8#diff-828e0013b8f3bc1bb22b4f57172b019dR19

It seems very clear to me the file is already stored like that, it could be incredibly outstanding to have the option the filename to be served directly (an option, so to don't break the WP's compatibility).

In PHPBB as per the core code I can use the native function if so served instead of code a ugly one, with the facility to override the gravatars in a simply manner, all what I need is the SERVER+filename.png served as it is, I will take care of all the rest.

Please :)

Safari seems to be rendering SVGs all of a sudden

Just starting noticing that when an avatar is displayed in Safari it renders as an SVG and doesn't respect the colour, or length options.

With the following code:

<img src="https://ui-avatars.com/api/?name=TestUser&size=40&length=1&background=bb65ca&color=fffff" />

We are seeing this rendered in Safari:

Screen Shot 2019-06-24 at 10 50 59 AM

In Chrome it looks fine:

image

Firefox also seems to be okay.

Any ideas? Has just seemed to be in the last few days or so.

some background values stopped working

Hi,

We are using the ui-avatar service for a long time now and since today's morning, we are seeing that when we are making a GET request with specific values we don't get a response

You can check it here:
https://ui-avatars.com/api/?name=First%20Last&rounded=true&background=3f5310&color=fff

When changing the background color to: 2C3E50
it seems that everything is working fine.
https://ui-avatars.com/api/?name=First%20Last&rounded=true&background=2C3E50&color=fff

Rounded Image Issue

Hi, love the project! We use UI Avatars in our software but we recently discovered that the rounded images are not quite generating properly from the ui-avatars website.

It currently seems to give the images a slight outer bend, but they're not complete circles.

It may not be an issue with the code in this project but some dependency issue with the deployment of the main website, but I wanted to bring it to your attention.

https://ui-avatars.com/api/?rounded=true returned
Rounded Image

And
https://ui-avatars.com/api/?background=434959&color=fff&name=Jesse+Mitchell&size=128&rounded=true returned
Rounded Image 2

Which actually looks rather cool but doesn't match the documentation.

Support on Open Collective

Hello,

We've started using UI Avatars for https://opencollective.com and I'd like to support the project with a monthly donation.

I saw that you have a page on BuyMeACoffee, but as Open Collective gives its engineering team gift cards so we can support the projects we use on the platform it would be way more convenient for us to donate on there directly.

I've created a pledge, you can claim the collective directly from there if you want to.

Anyway thanks for this great service!

ui-avatars.com is down; domain appears to have expired

Registrar Registration Expiration Date: 2020-10-01T14:12:41.00Z

screenshot 2020-10-01 at 10 39 14@2x

Domain name: ui-avatars.com
Registry Domain ID: 2169387377_DOMAIN_COM-VRSN
Registrar WHOIS Server: whois.namecheap.com
Registrar URL: http://www.namecheap.com
Updated Date: 2019-09-30T16:09:42.49Z
Creation Date: 2017-10-01T14:12:41.00Z
Registrar Registration Expiration Date: 2020-10-01T14:12:41.00Z
Registrar: NAMECHEAP INC
Registrar IANA ID: 1068
Registrar Abuse Contact Email: [email protected]
Registrar Abuse Contact Phone: +1.6613102107
Reseller: NAMECHEAP INC
Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
Registry Registrant ID: 
Registrant Name: WhoisGuard Protected
Registrant Organization: WhoisGuard, Inc.
Registrant Street: P.O. Box 0823-03411 
Registrant City: Panama
Registrant State/Province: Panama
Registrant Postal Code: 
Registrant Country: PA
Registrant Phone: +507.8365503
Registrant Phone Ext: 
Registrant Fax: +51.17057182
Registrant Fax Ext: 
Registrant Email: [email protected]
Registry Admin ID: 
Admin Name: WhoisGuard Protected
Admin Organization: WhoisGuard, Inc.
Admin Street: P.O. Box 0823-03411 
Admin City: Panama
Admin State/Province: Panama
Admin Postal Code: 
Admin Country: PA
Admin Phone: +507.8365503
Admin Phone Ext: 
Admin Fax: +51.17057182
Admin Fax Ext: 
Admin Email: [email protected]
Registry Tech ID: 
Tech Name: WhoisGuard Protected
Tech Organization: WhoisGuard, Inc.
Tech Street: P.O. Box 0823-03411 
Tech City: Panama
Tech State/Province: Panama
Tech Postal Code: 
Tech Country: PA
Tech Phone: +507.8365503
Tech Phone Ext: 
Tech Fax: +51.17057182
Tech Fax Ext: 
Tech Email: [email protected]
Name Server: dns101.registrar-servers.com
Name Server: dns102.registrar-servers.com
DNSSEC: unsigned
URL of the ICANN WHOIS Data Problem Reporting System: http://wdprs.internic.net/
>>> Last update of WHOIS database: 2020-10-01T02:37:30.98Z <<<

Issue with this URL

Any other combination of words work fine but not this "7W" and this color combination and size:

https://eu.ui-avatars.com/api/?name=7W&color=7F9CF5&background=EBF4FF&size=120

For example AB works fine:

https://eu.ui-avatars.com/api/?name=AB&color=7F9CF5&background=EBF4FF&size=120

Or also another color:

https://eu.ui-avatars.com/api/?name=7W&color=000000&background=EBF4FF&size=120

This color combination/size it's used by Jetstream

receiving duplicate cors headers

I'm receiving ui-avatars from my users to use as their profile picture.

I'm using xhr to fetch these images, but they are sent with doubled cors headers resulting in the following header
Access to image at 'https://eu.ui-avatars.com/api/?name=Sam%20Vdb&size=120$1629186020453' from origin 'http://localhost:3000' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed.

header list

access-control-allow-credentials: true
access-control-allow-headers: Content-Type, Accept, X-Requested-With, remember-me
access-control-allow-headers: Content-Type, Accept, X-Requested-With, remember-me
access-control-allow-methods: GET, OPTIONS
access-control-allow-methods: GET, OPTIONS
access-control-allow-origin: *
access-control-allow-origin: *
access-control-max-age: 1814400
access-control-max-age: 3600
...

No usage tracking

"No usage tracking"

But there are 4 cookies stored without user consent.
Is this illegal according to european GDPR law?

Multiple parameters causing API to generate no image and break in production

Hi everyone, I'm finding some errors with this API in production, particularly when I add a size parameter to the following URL:

This runs fine before I add the sizing:

https://ui-avatars.com/api/?name=Bob+Alice&background=0D8ABC&color=fff&rounded=true

This breaks when I add sizing:
https://ui-avatars.com/api/?name=Bob+Alice&background=0D8ABC&color=fff&rounded=true&size=256

This used to work before, but suddenly it's failing.

Here's the reverse:

This works with the sizing:
https://ui-avatars.com/api/?name=Bob+Alice&size=256&rounded=true

This breaks when I add the colors:
https://ui-avatars.com/api/?name=Bob+Alice&size=256&rounded=true&&background=0D8ABC&color=fff

I'm not entirely sure what's going on, but it's definitely strange.

HTTP responses

Does the API serve http responses as well or should I use cUrl?

Thanks :)

Not Receiving Access-Control-Allow-Origin Header

After making the following request in local environment, I receive an error that there is no Access-Control-Allow-Origin header on the response. It's also not present in the response headers in Chrome's Developer Tools.

const options = {
  mode: 'cors',
  crossDomain: true,
  credentials: 'include'
};
const url = 'https://ui-avatars.com/api/?name=Abe+Froman'
fetch(url, options).then(response => console.log(response))

Make it an array the "multiple usernames joined" exclusions on a per use case

It happens some fancy user likes to join multiple usernames with an hyphenation or the likes, I started making an array of exclusions which is managed as per admin's choice in the phpBB's ACP (Administration Control Panel)

This way.. you know ;)

/* for user "John Doe" or "John_Doe" use 'John+Doe' etc */ $pia_rep_ary = [' ', '_']; $name = str_replace($pia_rep_ary, '+', $this->user->data['username']);

Add support for gradient backgrounds

I propose to add &gradient=1 to make a background gradient, based on the background property, where the bottom will be a little darker, and the top a little brighter.

For example:

Screenshot 2020-12-21 at 17 38 57

Transparent background (Lowercase support)

Hello, thanks for your hard work. Appreciated.

I am writing an extension for phpBB, I see in the references of the Web API there isn't a transparence method to use. Is it implemented and just nor mentioned or?

Example:
https://ui-avatars.com/api/?name=3Di&length=3&background=0D8ABC&color=fff&rounded=true&size=128

The img generated is rounded but on a grey background. (and doesn't take care of lowercase letters?)

If the img would have been square then with CSS inline is not a prob I know.

Thanks. :)

Any workaround for Gravatar fallback problem?

I'm using a URL like this:

https://www.gravatar.com/avatar/00000000000000000000000000000000?s=200&d=https%3A%2F%2Fui-avatars.com%2Fapi%2FJohn+Smith%2F200

I've also tried %20 between the first and last name, but no matter what, Gravatar seems to strip out the spacing and the initials end up as "JO" instead of "JS" because Gravatar sees the name as JohnSmith, with no spaces.

Issues on the ui-avatars.com server

$ curl "https://ui-avatars.com/api/?name=Ell&color=fff&background=9b9b9b&size=500" --output file.png
$ cat file.png 
<br />
<b>Fatal error</b>:  Uncaught Intervention\Image\Exception\NotWritableException: Can't write image data to path (/home/forge/na.ui-avatars.com/api/../cache/0e13116310d9f1ba0dd5bb6c09e4b3d2.png) in /home/forge/na.ui-avatars.com/vendor/intervention/image/src/Intervention/Image/Image.php:150
Stack trace:
#0 /home/forge/na.ui-avatars.com/api/index.php(89): Intervention\Image\Image-&gt;save('/home/forge/na....', 100)
#1 {main}
  thrown in <b>/home/forge/na.ui-avatars.com/vendor/intervention/image/src/Intervention/Image/Image.php</b> on line <b>150</b><br />

Background color

Hi,
Thank your for your project we are using everyday in production!

Something we have noticed recently:
Before, when not defined, it seemed like background color was assigned randomly depending on user name. Since few days we have noticed that now everyone have the same background color :
https://ui-avatars.com/api/?name=John+Doe
https://ui-avatars.com/api/?name=Michel+Doe

Was it a deliberate change on API?
Is there any parameter we could set to avoid computing random background color by ourself?

Thanks for your help!
Etienne

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.