Avatar Redirect
Redirects to a user’s profile picture on any of the supported social networks.
Currently supported:
- Skype
- Vkontakte
Looking for an easy way to plug this service into React? Check out react-avatar.
Example:
Deployment
Google App Engine
Requires the Google Cloud SDK to be installed
Modify any of the settings in the app.yaml
file.
gcloud config set project <project-id>
gcloud app deploy
Heroku
Push this repository to a Heroku app or use the Deploy to Heroku button.
Usage
Each avatar URL follows the same base format which is <base-url>/<network-name>/<user-name>
, for Twitter this would be https://avatar-redirect.appspot.com/twitter/jorgenevens
.
If you are simply trying to show an avatar that would look something like this in HTML:
<img src="https://avatar-redirect.appspot.com/twitter/jorgenevens"
alt="JorgenEvens on Twitter" />
Configuration
The app is configured using environment variables which you either add to your app.yaml
file or set using the Heroku CLI / Dashboard.
Environment variable | Description | Default value |
---|---|---|
REDIS_URL | connectionString used to connect to a Redis cache | undefined |
MEMCACHE_URL | connectionString used to connect to a Memcache instance | undefined |
TTL_PROFILE_PICTURE | The duration for which the picture URL is cached in ms | 3600000 (1 hour) |
LIMIT_REFERER | A regular expression matched against the Referer header. If the Referer does not match a 401 Unauthorized will be returned. |
undefined |
LOG_FORMAT | A valid log format as specified in the morgan documentation | "combined" |
Network Configuration | ||
NETWORKS | The social networks available to this deployment, if no value is set all are enabled. | undefined |
VKONTAKTE_KEY | A Vkontakte service key to perform API requests with. | undefined |
VKONTAKTE_API_VERSION | The API version to use for Vkontakte | "5.101" |
GOOGLE_API_KEY | The API Key to a Google Cloud Platform project that has access to the People API. | undefined |
Contributing
I really appreciate any contribution you would like to make, so don’t hesitate to report an issue or submit pull requests.
About me
Hi, my name is Jorgen Evens. By day I built things (mainly in PHP and JavaScript) for employee advocacy platform Ambassify and by night I tinker around with these kinds of projects.