aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKieu Anh Tuan <[email protected]>2014-01-07 17:03:03 +0100
committerKieu Anh Tuan <[email protected]>2014-01-07 17:11:31 +0100
commit41688effa91319121a7fe8a981c4a7ebb986339b (patch)
tree57296829cca4b3bef922858c50378094895ae251 /lib
parent1bd1d73d29222c4e2f52d63a4282345b63a324df (diff)
downloadfaker-41688effa91319121a7fe8a981c4a7ebb986339b.tar.xz
faker-41688effa91319121a7fe8a981c4a7ebb986339b.zip
Add support to lorempixel image provider
Diffstat (limited to 'lib')
-rw-r--r--lib/image.js56
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;