Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Fetch images from own database or google drive / amazon aws #2002

Open
jackbali opened this issue May 21, 2020 · 1 comment
Open

Fetch images from own database or google drive / amazon aws #2002

jackbali opened this issue May 21, 2020 · 1 comment

Comments

@jackbali
Copy link

Hello everyone,

I'm new here and I really hope my comment / request will not be annoying, I'm using faker and I really like it, I would just understand if would be possible instead to use images from lorempixel use my own images and fetch them from a online database ( google drive / amazon aws).

I've tried to search but I could not find something to help me.

Thanx in advance for your support.

@jayenne
Copy link

jayenne commented May 29, 2020

Faker it doesn't do anything other than create a url to put in your database.

Faker->imageUrl doesn't "deal with images" it simply constructs a url for the lorempixel website. it's the orempixel that resolves it to an image.

So, If you know the url/path/filename for your images then you don't need to use faker for that, you just set your field to it OR create a function to contruct the path for you then poplate the field with that.

e.g.. faker->imageUrl($width = 640, $height = 480) will return the value "http://www.lorempixel.com/" for you to then add to your database:
$avatar = $faker->imageUrl($width = 640, $height = 480)

if you have your own image urls then you simply use that instead of Faker..
'avatar' = $my_image_url
or call a function to construct one for you*
'avatar' = myImageUrlGenerator($arg1,$arg2...);

*You could write your own Faker provider to do this.

If you don't have a resolvable URL to a specific image then you will need to write a function to server images based on your specific needs. this could include sizes, effects, subjects etc... but that's all your own work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants