Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faker->image() return 0 on windows local env #475

Closed
FFomaXX opened this issue May 11, 2022 · 15 comments
Closed

Faker->image() return 0 on windows local env #475

FFomaXX opened this issue May 11, 2022 · 15 comments
Labels
wontfix This will not be worked on

Comments

@FFomaXX
Copy link

FFomaXX commented May 11, 2022

Versions

Module/Lib Version
PHP 8.1.5
fakerphp/faker 1.19.0
Laravel 9.10.0

Faker->image() return 0 on windows local env, but it works with adding at Faker\Provider\Image after string 114:

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

Is this a safe solution?

@pimjansen
Copy link

No this means there is an ssl issue at the image host. Ignoring the ssl certificate is never a secure option

@schonhoff
Copy link

schonhoff commented May 12, 2022

Hello,
we have the same issue. Would love to see a solution for this. Is there another way to fake an image?

PHP 8.0.18
fakerphp/faker 1.19.0
laravel/framework 9.12.2

@alexhampu
Copy link

I also have issues with Faker returning false when generating an image. After investigating, the reason is caused by CloudFlare blocking the request on my IP, but if I access the generated placeholder.com link, CloudFlare doesn't block my request.

@saldasib
Copy link

Hello,

I have similar issue and I (temporary locally) solved adding User-Agent:
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0');

image

like suggest here:
https://stackoverflow.com/questions/62425649/cant-load-image-by-placeholder-com-url

@schonhoff
Copy link

schonhoff commented May 12, 2022

Hello,

I have similar issue and I (temporary locally) solved adding User-Agent: curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0');

image

like suggest here: https://stackoverflow.com/questions/62425649/cant-load-image-by-placeholder-com-url

Maybe that could be included into the package as a PR/Commit. It worked for me but changing a vendor package is not the way I would solve the issue.

@saldasib
Copy link

Hello,
I have similar issue and I (temporary locally) solved adding User-Agent: curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0');
image
like suggest here: https://stackoverflow.com/questions/62425649/cant-load-image-by-placeholder-com-url

Maybe that could be included into the package as a PR/Commit. It worked for me but changing a vendor package is not the way I would solve the issue.

Yes Totally agree with you, I just have no time to do PR/Commit and only a quick local test

@pluc
Copy link

pluc commented May 12, 2022

The same thing is happening to me where $faker->image() is returning FALSE now as of the latest version.

This could be a placeholder.com issue which means, for Faker, that it should allow alternatives.

@pimjansen
Copy link

pimjansen commented May 12, 2022

Just to summarize. The issue is not Faker itself but the external vendor where it retrieves the images (placeholder.com).

It is also something we won't fix since it would mean a breaking change where we have to add an extra dependency on php-gd to generate the actual images.

For Faker 2.x we will remove the image generation from the Core package where an external one can be used.

For now i suggest using a custom provider instead

@pimjansen pimjansen added the wontfix This will not be worked on label May 12, 2022
@pluc
Copy link

pluc commented May 12, 2022

Anyone who's here looking for a quick fix, this could help:

https://github.com/morawskim/faker-images

@alexhampu
Copy link

@pluc this is a good alternative for me, instead of creating a custom provider myself. Thanks!

@koficoud
Copy link

Just to summarize. The issue is not Faker itself but the external vendor where it retrieves the images (placeholder.com).

It is also something we won't fix since it would mean a breaking change where we have to add an extra dependency on php-gd to generate the actual images.

For Faker 2.x we will remove the image generation from the Core package where an external one can be used.

For now i suggest using a custom provider instead

Adding an option in CURL, isn't that a solution? In this case a user agent.

@pluc
Copy link

pluc commented May 12, 2022

Is this a safe solution?

No this means there is an ssl issue at the image host. Ignoring the ssl certificate is never a secure option

The user agent has nothing to do with it

@petsoukos
Copy link

Please check if you can curl anything from placeholder.com, they use Cloudflare maybe you have been blocked.

  • assuming placeholder.com is your provider

@mishinroman94
Copy link

Can you please tell me when the new working version will be released?

@pimjansen
Copy link

Can you please tell me when the new working version will be released?

There wont be a release or a fix for this. Its an external service that is used (placeholder.com)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

9 participants