1. Go to this page and download the library: Download bradietilley/faker-imagez 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/ */
bradietilley / faker-imagez example snippets
class Something extends Imagez
{
public static function basePath(): string
{
return '/path/to/images';
}
}
imagez()->iterate(); // Iterates to the next image
imagez()->getCurrentImagePath(); // string: /path/to/pics/image_0046.jpeg (won't iterate)
imagez()->getCurrentImagePath(); // string: /path/to/pics/image_0046.jpeg (won't iterate)
imagez()->getCurrentImageContents(); // string: <contents of /path/to/pics/image_0046.jpeg> (won't iterate)
imagez()->getCurrentImageFileinfo(); // \SplFileInfo: /path/to/pics/image_0046.jpeg (won't iterate)
imagez()->all(); // array: <path1, path2, ..., path118, path119, path120>
imagez()->path(); // this iterates the pool, popping the last path from the pool
imagez()->pool(); // array: <path1, path2, ..., path118, path119> (pool contains one less now)
imagez()->path(); // this iterates the pool, popping the last path from the pool
imagez()->pool(); // array: <path1, path2, ..., path118> (pool contains one less now)
foreach (range(1, 100) as $i) {
imagez()->path(); // iterates 100 images
}
imagez()->loadWhenEmpty(); // Won't do anything here as there's still images in the pool.
imagez()->load(); // Will reload the pool of images to be the full collection of image images.
$all = imagez()->all();
unset($all[23452]); // Say you don't like this one
imagez()->replaceAll($all);
imagez()->path(); // Will never
$generator = catz()->combine(dogz(), foodz());
// or
$generator = CombineImagez::make(catz(), dogz(), foodz());
// Then interact with it as you otherwise would:
$generator->path(); // path to a dog image
$generator->path(); // path to a cat image
$generator->path(); // path to a food image
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.