diff --git a/src/Faker/Provider/Image.php b/src/Faker/Provider/Image.php index 0def1371bc..0e31d50fae 100644 --- a/src/Faker/Provider/Image.php +++ b/src/Faker/Provider/Image.php @@ -19,9 +19,15 @@ class Image extends Base * * @example 'http://lorempixel.com/640/480/?12345' */ - public static function imageUrl($width = 640, $height = 480, $category = null, $randomize = true, $word = null) + public static function imageUrl($width = 640, $height = 480, $category = null, $randomize = true, $word = null, $gray = false) { - $url = "http://lorempixel.com/{$width}/{$height}/"; + $baseUrl = "http://lorempixel.com/"; + $url = "{$width}/{$height}/"; + + if ($gray) { + $url = "gray/" . $url; + } + if ($category) { if (!in_array($category, static::$categories)) { throw new \InvalidArgumentException(sprintf('Unknown image category "%s"', $category)); @@ -36,7 +42,7 @@ public static function imageUrl($width = 640, $height = 480, $category = null, $ $url .= '?' . static::randomNumber(5, true); } - return $url; + return $baseUrl . $url; } /**