PHP code example of woodsandwalker / faker-picture
1. Go to this page and download the library: Download woodsandwalker/faker-picture library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
woodsandwalker / faker-picture example snippets
e the factory to create a Faker\Generator instance
$faker = Faker\Factory::create();
// add the picture provider to Faker
$faker->addProvider(new WW\Faker\Provider\Picture($faker));
// generate a picture url
echo $faker->pictureUrl(
640, // width (px)
480, // height (px)
false, // grayscale (boolean)
0, // blur (0 = no blur, 10 = max blur)
);
// 'https://picsum.photos/640/480'
// generate and save picture and return filepath
echo $faker->picture(
null, // directory to save picture (string)
640, // width (px)
480, // height (px)
true, // whether to return full path or just file name (boolean)
false, // grayscale (boolean)
0, // blur (0 = no blur, 10 = max blur)
);
// '/tmp/0a23be9a5ab609119e14223a22acce50.jpg'
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.