random_images
Pull urls of random images from google searches to generate sample data.
Installation
sudo gem install random_images
In your config/environment.rb
config.gem 'random_images', :version => '=>0.0.9'
To get Images
RandomImages::Images.get
You can also call pass parameters
RandomImages::Images.get(number, keyword, content)
Where number is the number of images to fetch (by default 100), keyword is the keyword for the google search (by default “me”) and content is the type of images, which can be “any” (ie, any image) or “face” (ie, pictures of faces, this is the default value).
You can get a single image, too
RandomImages::Image.get
Or with parameters
RandomImages::Image.get(keyword, content)
Example
http://hackdd.co.uk/random/example
API
There’s an API avalailable in my website, it returns the results as text/JSON. The calls are as follows:
Images
http://hackdd.co.uk/random/images
Images with params
http://hackdd.co.uk/random/images?number=[YOUR_NUMBER]&keyword=[YOUR_KEYWORD]&content=[YOUR_CONTENT]
Image
http://hackdd.co.uk/random/image
Image with params
http://hackdd.co.uk/random/image?keyword=[YOUR_KEYWORD]&content=[YOUR_CONTENT]
Note on Patches/Pull Requests
-
Fork the project.
-
Make your feature addition or bug fix.
-
Add tests for it. This is important so I don’t break it in a future version unintentionally.
-
Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
-
Send me a pull request. Bonus points for topic branches.
Copyright
Copyright © 2010 Jordi Noguera. See LICENSE for details.