diff options
| author | Kieu Anh Tuan <[email protected]> | 2014-01-07 17:03:03 +0100 |
|---|---|---|
| committer | Kieu Anh Tuan <[email protected]> | 2014-01-07 17:11:31 +0100 |
| commit | 41688effa91319121a7fe8a981c4a7ebb986339b (patch) | |
| tree | 57296829cca4b3bef922858c50378094895ae251 /lib | |
| parent | 1bd1d73d29222c4e2f52d63a4282345b63a324df (diff) | |
| download | faker-41688effa91319121a7fe8a981c4a7ebb986339b.tar.xz faker-41688effa91319121a7fe8a981c4a7ebb986339b.zip | |
Add support to lorempixel image provider
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/image.js | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/lib/image.js b/lib/image.js new file mode 100644 index 00000000..0456dd84 --- /dev/null +++ b/lib/image.js @@ -0,0 +1,56 @@ +var Faker = require('../index'); +var imageProviderUrl = 'http://lorempixel.com/'; +var image = { + imageUrl: function (width, height, category) { + var width = width || 640; + var height = height || 480; + + var url = imageProviderUrl + width + '/' + height; + if (typeof category !== 'undefined') { + url += '/' + category; + } + + return url; + }, + abstract: function (width, height) { + return image.imageUrl(width, height, 'abstract'); + }, + animals: function(width, height) { + return image.imageUrl(width, height, 'animals'); + }, + business: function(width, height) { + return image.imageUrl(width, height, 'business'); + }, + cats: function(width, height) { + return image.imageUrl(width, height, 'cats'); + }, + city: function(width, height) { + return image.imageUrl(width, height, 'city'); + }, + food: function(width, height) { + return image.imageUrl(width, height, 'food'); + }, + nightlife: function(width, height) { + return image.imageUrl(width, height, 'nightlife'); + }, + fashion: function(width, height) { + return image.imageUrl(width, height, 'fashion'); + }, + people: function(width, height) { + return image.imageUrl(width, height, 'people'); + }, + nature: function(width, height) { + return image.imageUrl(width, height, 'nature'); + }, + sports: function(width, height) { + return image.imageUrl(width, height, 'sports'); + }, + technics: function(width, height) { + return image.imageUrl(width, height, 'technics'); + }, + transport: function(width, height) { + return image.imageUrl(width, height, 'transport'); + } +}; + +module.exports = image; |
