lasserafn / ui-avatars Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
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))
cc @LasseRafn
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']);
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
...
Since you used thai-lang in promote pic, and ui-avatars is supported thai
This is good, But a bit wrong with counting chars.
Some vowels / tone marks should be not count.
Example:
if ชิน = Result should be ชิน (Chin) (3) not just ชิ (Chi)(2)
Wiki : https://en.wikipedia.org/wiki/Thai_alphabet
Thanks for supporting thai lang. hehe 😄
PS: Maybe this will help https://github.com/devongovett/grapheme-breaker
See #43 for something not deployed (and see the discussion there about other differences)
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. :)
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"
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!)
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 .
Error:
https://i0.wp.com/ui-avatars.com/api/ivelinasheetl/48/9B5DE5/FFFFFF/2/0.5/false/true/false/png?ssl=1
Error:
https://i0.wp.com/ui-avatars.com/api/JennaFairlo/64/A5A58D/FFFFFF/1/0.5/false/true/false/png?ssl=1
Good:
https://i0.wp.com/ui-avatars.com/api/JennaFairlo/64/A5A58D/FFFFFF/2/0.5/false/true/false/png?ssl=1
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
Would be great to specify license type and add a LICENSE file to the repository.
Thanks in advance.
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
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.
Help plz
Fatal error: Uncaught Error: Class 'Utils\Input' not found in /home/b/site.ru/public_html/api/index.php:19 Stack trace: #0 {main} thrown in /home/b/site.ru/public_html/api/index.php on line 19
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
Add option to specify bold font &font-weight=bold
. Like in CSS
font-wight: bold;
"No usage tracking"
But there are 4 cookies stored without user consent.
Is this illegal according to european GDPR law?
Hi there :) Sorry for being dense, first off.
I would like to know if the cached timegap
https://github.com/LasseRafn/ui-avatars/blob/master/cron/cleanup.php
which is at the moment hard-coded to 2 days could become an option or if there are any reasons why it is static, thanks in advance.
Best regards 🥇
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 :)
JPEG compression is not designed for text. Please add PNG support so I don't have to make the resolution higher to compensate.
Here's a video to explain why:
https://youtu.be/yBX8GFqt6GA
Registrar Registration Expiration Date: 2020-10-01T14:12:41.00Z
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 <<<
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.
Does the API serve http responses as well or should I use cUrl?
Thanks :)
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
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:
In Chrome it looks fine:
Firefox also seems to be okay.
Any ideas? Has just seemed to be in the last few days or so.
Hi,
sorry, my OCD is bugging me again.
Could it be possible to center the text on the image?
Example of an avatar where text is not in aligned to the center:
https://ui-avatars.com/api/?name=II&size=250
ps. Awesome service to help out with project bootstrapping.
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!
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();
https://github.com/LasseRafn/ui-avatars/blob/master/index.html does not have the same content for the Privacy and Monitoring
section than https://ui-avatars.com/
$ 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->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 />
The composer.json requires ^3.0
of lasserafn/php-initial-avatar-generator
, but the current version of the library is 4.1.
Shows SSL issue, pls have a look
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.
our clients call to inform us why they have empty avatars
Please update your ssl certificate
The lasserafn/php-initial-avatar-generator has support for generating SVG avatars, but the SVG generation in this repo is a different one.
Hi mate,
a question arises there, is the API correctly handling RTL languages?
For reference I found this discussion:
https://stackoverflow.com/questions/7780339/error-while-writting-arabic-to-image
Many thanks.
Add two new sections:
Should contain links and descriptions to projects that make use of the api
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:
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
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
And
https://ui-avatars.com/api/?background=434959&color=fff&name=Jesse+Mitchell&size=128&rounded=true
returned
Which actually looks rather cool but doesn't match the documentation.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.