fake-rs icon indicating copy to clipboard operation
fake-rs copied to clipboard

Feature : Add an image faker

Open theredfish opened this issue 6 years ago • 5 comments

Hello, What about adding an image faker? We could use this kind of API : http://lorempixel.com/

Let me know if your interested and i will contribute.

theredfish avatar Sep 12 '19 19:09 theredfish

It will be great to have image faker, but I am not sure is it a good idea to couple with specific image provider. Can you share more about the details? i.e. the faker config and output

cksac avatar Sep 13 '19 02:09 cksac

The idea behind the image faker is to provide image URLs in order to display them on a website for example or get them through an API call. Lorempixel is one of fake image providers that offer a way to configure placeholder images.

We can imagine something like that :

let image_url: String = Image(400, 200).fake()
println!("Image url : {}", image_url"); // http://lorempixel.com/400/200/

A PHP library uses lorempixel, you can see the different use cases here : https://github.com/fzaninotto/Faker#fakerproviderimage

Indeed if the image provider stop working one day it will be an issue.

theredfish avatar Sep 14 '19 12:09 theredfish

If the api is specific to lorempixel, I think the config object can be Lorempixel under image category? i.e. let image_url: String = Lorempixel(400, 200).fake(), so that we can also implement other image provider when needed.

cksac avatar Sep 16 '19 02:09 cksac

Ok! I will try something like that 👍

theredfish avatar Sep 17 '19 14:09 theredfish