-1

These day my seeders broke because faker is returning false instead of an image path, so i dumped into the vendor folders to understand what is happening. I discovered that the request done to the website used to generate random images (via.placeholder.com) is returning 403 error instead of 200 success status code. I don't know what to do to solve this issue, really. Any advices is really appreciate.

coderz
  • 72
  • 6
  • Accessing the website, sometimes it gives me error 522, but when i try to do the same request that my webserver do on my browser it works without problems – coderz May 22 '22 at 14:19
  • It seems that https://placeholder.com/ is unstable – Alon Eitan May 22 '22 at 14:25

2 Answers2

2

It seems placeholder.com changed something or blocked some IPs because this is popular problem right now (I also experience this a few days ago).

Instead you should install for example https://github.com/smknstd/fakerphp-picsum-images package and instead of setting faker provider (I had problem with this) you can just use:

FakerPicsumImagesProvider::image()

to get image content.

Marcin Nabiałek
  • 109,655
  • 42
  • 258
  • 291
1

Consider using alternative packages like "alirezasedghi/laravel-image-faker" to get faker images from multiple sources such as Lorem Picsum, LoremFlickr, PlaceDog, Kittens (Random Cats), and Fake People.

You can find more information and documentation about this package at: https://github.com/alirezasedghi/laravel-image-faker

Usage example:

public function definition(): array
{
    return [
        'title' => $this->faker->sentence(),
        'content' => $this->faker->paragraph(),
        'attachments' => (new ImageFaker(new Picsum()))->image( storage_path("app/attachments/") )
    ];
}