Project

uifaces

0.0
No commit activity in last 3 years
No release in over 3 years
Get profile images from uifaces.com, by @calebogden
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0
 Project Readme

UIFaces

A simple library to generate a url of photo of a face, for use in development, design, and testing of your local projects.

Generates urls that point to the awesome uiFaces by @calebogden

Installation

Add this line to your application's Gemfile:

gem 'uifaces'

And then execute:

$ bundle

Or install it yourself as:

$ gem install uifaces

Usage

Get a random face:

If you don't care which face is assigned to a particular user or place in your page, use this:

UIFaces::face # => "http://uifaces.com/faces/_twitter/vehbikilic_120.jpg"

Get a specific face:

If you are assigning faces to users of your app for development/testing, you may want to avoid having the same faces assigned randomly to different users.

If so, you can pass an integer index to retrieve the Nth face.

UIFaces::face(1) => "http://uifaces.com/faces/_twitter/VinThomas_120.jpg"
UIFaces::face(1) => "http://uifaces.com/faces/_twitter/VinThomas_120.jpg"

If you pass an index higher than the number of faces, it will recycle the faces starting with the first face, so you can use this to map a face to profile id, for instance:

User.each do |user|
  user.photo = UIFaces::face(u.id)
end

Ideas

  • Build some system to locally cache the images
  • Integrate with twitter to get faces of your followers/followings

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Credits

Big shoutout to @calebogden for building uiFaces. Library written by @jakeonrails