Mahmoud Shiref
Mahmoud Shiref

Reputation: 56

using Faker to fake images always returns false

Hello guys I'm trying to use Faker to populate images on my localhost but it always return false. this is my code

use Faker\Factory as Faker;
$faker = new Faker;
$faker::create()->image('public/images', 400, 300, null, false); // This returns false instead of the created image name.

I tried is with tinker and hardcoded in my code and always returns the same thing. I think it's because of permissions or something like that. I'm using kali linux. I also tried sudo chmod -R 777 on my folders but same problem still exists. Can anyone here help me?

Upvotes: 1

Views: 4286

Answers (1)

Mahmoud Shiref
Mahmoud Shiref

Reputation: 56

I solved it. There was two errors. the first one was that lorempixel.com doesn't work with me (I don't know why I just try to visit it with my browser and it doesn't open. returns "This site can’t be reached"). So I replaced that link with placekitten.com and it returned the same problem "return false". after many attempts with curl to find out the problem I found that I must not use https with placekitten.com. I edited it and it works well!

Upvotes: 1

Related Questions