1. Go to this page and download the library: Download germania-kg/imagefinder 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/ */
germania-kg / imagefinder example snippets
use Germania\ImageFinder\ImageFinder;
use Symfony\Component\Finder\Finder;
// Setup
$finder = new Finder;
$image_finder = new ImageFinder( $finder );
// Grab from directory
$images = $image_finder( '/path/to/photos' );
foreach ($images as $image) {
// Stolen from Symfony docs:
// Dump the absolute path
var_dump($file->getRealPath());
// Dump the relative path to the file, omitting the filename
var_dump($file->getRelativePath());
// Dump the relative path to the file
var_dump($file->getRelativePathname());
}