Skip to content

Commit

Permalink
add kittens service
Browse files Browse the repository at this point in the history
  • Loading branch information
AlirezaSedghi committed May 4, 2023
1 parent 0ac6abd commit 1b7d84f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ The following sources are utilized by this project to create random images:
- [Lorem Picsum](https://picsum.photos/)
- [LoremFlickr](https://loremflickr.com/)
- [PlaceDog](https://placedog.net/)
- [Kittens (Random Cats) by TheOldReader.com](https://theoldreader.com/kittens/)
- [Fake People by BoredHumans.com](https://boredhumans.com/faces.php)

## Methods
Expand All @@ -44,6 +45,7 @@ public function definition(): array
* In order to utilize other services, the following substitutes can be used:
* - new ImageFaker(new LoremFlickr());
* - new ImageFaker(new PlaceDog());
* - new ImageFaker(new Kittens());
* - new ImageFaker(new FakePeople());
*/
$imageFaker = new ImageFaker(new Picsum());
Expand Down
34 changes: 34 additions & 0 deletions src/Services/Kittens.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace Alirezasedghi\LaravelImageFaker\Services;

use Alirezasedghi\LaravelImageFaker\Base;

class Kittens extends Base
{
/**
* Unfortunately, custom filters like grayscale and blur are not currently available.
*/

/**
* Service base url
*/
public string $base_url = 'http://theoldreader.com/kittens';

/**
* Make url to get images
*
* @param int $width
* @param int $height
* @param array $imageOptions
* @return string
*/
protected function makeUrl(int $width = 640, int $height = 480, array $imageOptions = []) {
return sprintf(
'%s/%s/%s',
$this->base_url,
$width,
$height
);
}
}

0 comments on commit 1b7d84f

Please sign in to comment.