Я работаю в Magento 2.3. Я хочу получить все мухи из каталога
http://localhost/magento23/pub/media/catalog/product
я использую класс RecursiveIteratorIterator, когда я использую getPathName ()
я получил
/ вар / WWW / HTML / magento23 / паб / СМИ / Каталог / продукта / м / ч / mh12-green_main.jpg
public function scd($path)
{
$di = new RecursiveDirectoryIterator($path);
$iterator = new RecursiveIteratorIterator($di, RecursiveIteratorIterator::CHILD_FIRST);
$files = [];
$allowed = ['jpg'];
foreach ($iterator as $file) {
$ext = pathinfo($file, PATHINFO_EXTENSION);
if (in_array($ext, $allowed)) {
$files[] = $file->getPathName();
}
}
return $files;
}
я хочу путь после
/ Каталог товаров
папка что-то вроде
/ м / ч / mh12-green_main.jpg
как я могу это сделать