{"id":13717857,"url":"https://github.com/lincanbin/Material-Design-Avatars","last_synced_at":"2025-05-07T08:30:39.471Z","repository":{"id":31263573,"uuid":"34825274","full_name":"lincanbin/Material-Design-Avatars","owner":"lincanbin","description":"Create material deisgn avatars for users just like Google Messager. It may not be unique but looks better than Identicon or Gravatar. ","archived":false,"fork":false,"pushed_at":"2017-11-09T08:54:30.000Z","size":5241,"stargazers_count":263,"open_issues_count":2,"forks_count":56,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-04-05T05:06:55.908Z","etag":null,"topics":["avatar","gravatar","material-design","php"],"latest_commit_sha":null,"homepage":"https://www.94cb.com/Material-Design-Avatars/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lincanbin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-30T00:19:01.000Z","updated_at":"2025-03-23T08:43:37.000Z","dependencies_parsed_at":"2022-09-19T08:02:37.874Z","dependency_job_id":null,"html_url":"https://github.com/lincanbin/Material-Design-Avatars","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lincanbin%2FMaterial-Design-Avatars","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lincanbin%2FMaterial-Design-Avatars/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lincanbin%2FMaterial-Design-Avatars/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lincanbin%2FMaterial-Design-Avatars/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lincanbin","download_url":"https://codeload.github.com/lincanbin/Material-Design-Avatars/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252793660,"owners_count":21805058,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["avatar","gravatar","material-design","php"],"created_at":"2024-08-03T00:01:28.204Z","updated_at":"2025-05-07T08:30:35.881Z","avatar_url":"https://github.com/lincanbin.png","language":"PHP","funding_links":[],"categories":["PHP","类库"],"sub_categories":["图像处理"],"readme":"# Material-Design-Avatars      [![Build Status](https://travis-ci.org/lincanbin/Material-Design-Avatars.svg?branch=master)](https://travis-ci.org/lincanbin/Material-Design-Avatars)\nCreate material deisgn avatars for users just like Google Messager. \n\nIt may not be unique but looks better than Identicon or Gravatar.\n\n\n[Online Demo](http://www.94cb.com/Material-Design-Avatars/)\n\nLanguage Support\n------------\n![E](http://www.94cb.com/Material-Design-Avatars/avatar.php?char=E\u0026size=64\u0026cache=none)![N](http://www.94cb.com/Material-Design-Avatars/avatar.php?char=N\u0026size=64)![G](http://www.94cb.com/Material-Design-Avatars/avatar.php?char=G\u0026size=64)![L](http://www.94cb.com/Material-Design-Avatars/avatar.php?char=L\u0026size=64\u0026cache=none)![I](http://www.94cb.com/Material-Design-Avatars/avatar.php?char=I\u0026size=64)![S](http://www.94cb.com/Material-Design-Avatars/avatar.php?char=S\u0026size=64\u0026cache=none)![H](http://www.94cb.com/Material-Design-Avatars/avatar.php?char=H\u0026size=64)\n\n![J](http://www.94cb.com/Material-Design-Avatars/avatar.php?char=%E7%AE%80\u0026size=64\u0026cache=none)![T](http://www.94cb.com/Material-Design-Avatars/avatar.php?char=%E4%BD%93\u0026size=64)![Z](http://www.94cb.com/Material-Design-Avatars/avatar.php?char=%E4%B8%AD\u0026size=64)![W](http://www.94cb.com/Material-Design-Avatars/avatar.php?char=%E6%96%87\u0026size=64)\n\n![F](http://www.94cb.com/Material-Design-Avatars/avatar.php?char=%E7%B9%81\u0026size=64)![T](http://www.94cb.com/Material-Design-Avatars/avatar.php?char=%E9%AB%94\u0026size=64\u0026cache=none)![Z](http://www.94cb.com/Material-Design-Avatars/avatar.php?char=%E4%B8%AD\u0026size=64\u0026cache=none)![W](http://www.94cb.com/Material-Design-Avatars/avatar.php?char=%E6%96%87\u0026size=64\u0026cache=none)\n\n![R](http://www.94cb.com/Material-Design-Avatars/avatar.php?char=%E3%81%AB\u0026size=64\u0026cache=none)![I](http://www.94cb.com/Material-Design-Avatars/avatar.php?char=%E3%81%BB\u0026size=64\u0026cache=none)![Y](http://www.94cb.com/Material-Design-Avatars/avatar.php?char=%E3%82%93\u0026size=64)![U](http://www.94cb.com/Material-Design-Avatars/avatar.php?char=%E3%81%94\u0026size=64)\n\n\nScreenshot\n------------\n[Carbon Forum](http://www.94cb.com)\n\n![Carbon Forum](https://cloud.githubusercontent.com/assets/5785188/7410189/2b6de268-ef5f-11e4-9499-96ae36383fa6.png)\n\n[Android Client for Carbon Forum](https://github.com/lincanbin/Android-Carbon-Forum)\n\n![Android Client for Carbon Forum](https://cloud.githubusercontent.com/assets/5785188/7678142/4f96e512-fd84-11e4-8225-83020e8f3688.png)\n\n\nRequirements\n------------\n* The PHP [__GD library__](http://php.net/manual/en/book.image.php).\n\n\nInitialize\n------------\n```php\n\u003c?php\nrequire(dirname(__FILE__) . \"/src/MDAvatars.php\");\n/*\n'X'         : The character that you want to fill to the avatar.\n512 (pixel) : The size of the avatar.\n*/\n$Avatar = new Md\\MDAvatars('X', 512);\n?\u003e\n```\n\nOr initialize with composer: \n\n\n```json\n{\n\t\"require\": {\n\t\t\"lincanbin/material-design-avatars\": \"*.*\"\n\t}\n}\n```\n```php\n\u003c?php\n// composer \nrequire(__DIR__ . \"/vendor/autoload.php\");\nuse Md\\MDAvatars;\n\n$Avatar = new MDAvatars('X', 512);\n?\u003e\n```\n\nUsage\n------------\n\n#### Show you avatar in the browser\n\n```php\n\u003c?php\n$Avatar-\u003eOutput2Browser();\n?\u003e\n```\n\n```php\n\u003c?php\n// You can resize the ouput size again here.\n$OutputSize = 256;\n$Avatar-\u003eOutput2Browser($OutputSize);\n// Output Base64 encoded image data.\n$Avatar-\u003eOutput2Base64($OutputSize);\n// Get an image resource identifier.\n$Avatar-\u003eOutput2ImageResource($OutputSize);\n?\u003e\n```\n\n#### Save avatar to a file\n\n```php\n\u003c?php\n$Avatar-\u003eSave('./avatars/Avatar.png');\n//You can resize the size you want to save again here.\n$Avatar-\u003eSave('./avatars/Avatar256.png', 256);\n$Avatar-\u003eSave('./avatars/Avatar128.png', 128);\n$Avatar-\u003eSave('./avatars/Avatar64.png', 64);\n?\u003e\n```\n\n#### Free memory\n\n```php\n\u003c?php\n$Avatar-\u003eFree();\n?\u003e\n```\n\n#### Notice\nIf you do not need Chinese support, you can delete ```src/fonts/SourceHanSansCN-Normal.ttf```.\n\nWhen you input a Chinese character, it will automatically extract the first letter of the pinyin of the Chinese character instead of the original input if you deleted ```src/fonts/SourceHanSansCN-Normal.ttf```. \n```php\n$Avatar = new MDAvtars('林', 512);//The pinyin of \"林\" is \"Lin\".\n```\nThis will be the same as that below if you deleted ```src/fonts/SourceHanSansCN-Normal.ttf```. \n```php\n$Avatar = new MDAvtars('L', 512);//The first letter of that pinyin is \"Lin\".\n```\n\nFonts\n------------\n[Source Code Pro](https://github.com/adobe-fonts/source-code-pro)\n\n[Source Han Sans](https://github.com/adobe-fonts/source-han-sans)\n\n\nLicense\n------------\n```\nCopyright 2015 Canbin Lin (lincanbin@hotmail.com)\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flincanbin%2FMaterial-Design-Avatars","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flincanbin%2FMaterial-Design-Avatars","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flincanbin%2FMaterial-Design-Avatars/lists"}