Merge image generators into a Faker::Image class #1972
Comments
|
Suggestion: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
|
Suggestion: |
Is your feature request related to a problem? Please describe.
I've been using
Faker::LoremPixel.imageandFaker::Avatar.imagefor a while in my database seeds and a few months ago the avatar seeder stopped working (I think this is because robohash was moved to being hosted behind Cloudflare, and Cloudflare will sometimes reject requests from Ruby). I wanted to fix this issue by moving the avatar generator to LoremPixel, but it turns out LoremPixel is also having issues and timing out requests pretty often.I think we should make the codebase simpler and make it easier to switch between these image generators by merging them into one
Faker::Imageclass, with methods likelorem_pixel,robohash, etc. For LoremPixel, it might be a good idea to remove the generator entirely since the site has been so flaky over the years.If you're adding new objects, please describe how you would use them
Faker::LoremPixel.imagewould becomeFaker::Image.lorem_pixelandFaker::Avatar.imagewould becomeFaker::Image.robohash. We should also probably move LoremFlickr and Placeholdit into this class.I'd also like to add Unsplash as an image source, like faker.js has done.
Describe alternatives you've considered
Making my own generators, I guess? IMO, merging them into one class is the cleanest solution.
Additional context
I made a quick example for an
unsplashmethod (should probably add validations):The text was updated successfully, but these errors were encountered: