Skip to content

Commit f774754

Browse files
authored
Added image formats to Faker\Provider\Image (#66)
1 parent 1e683b8 commit f774754

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

docs/formatters/image.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ function imageUrl(
1313
?string $category = null, /* used as text on the image */
1414
bool $randomize = true,
1515
?string $word = null,
16-
bool $gray = false
16+
bool $gray = false,
17+
string $format = 'png'
1718
): string;
1819
```
1920

@@ -31,6 +32,10 @@ echo $faker->imageUrl(360, 360, 'animals', true, 'cats');
3132
echo $faker->imageUrl(360, 360, 'animals', true, 'dogs', true);
3233

3334
// https://via.placeholder.com/360x360.png/CCCCCC?text=animals+dogs+veniam
35+
36+
echo $faker->imageUrl(360, 360, 'animals', true, 'dogs', true, 'jpg');
37+
38+
// https://via.placeholder.com/360x360.jpg/CCCCCC?text=animals+dogs+veniam
3439
```
3540

3641
## `image`
@@ -50,7 +55,8 @@ function image(
5055
bool $fullPath = true,
5156
bool $randomize = true,
5257
?string $word = null,
53-
bool $gray = false
58+
bool $gray = false,
59+
string $format = 'png'
5460
)
5561
```
5662

@@ -68,4 +74,8 @@ echo $faker->image(null, 360, 360, 'animals', true);
6874
echo $faker->image(null, 360, 360, 'animals', true, true, 'cats', true);
6975

7076
// '/tmp/9444227f06f0b024a14688ef3b31fe7a.png'
77+
78+
echo $faker->image(null, 360, 360, 'animals', true, true, 'cats', true, 'jpg');
79+
80+
// '/tmp/9444227f06f0b024a14688ef3b31fe7a.jpg'
7181
```

0 commit comments

Comments
 (0)