public function fieldFilterValuePhotos($object) { global $conf; $photos = []; $dir = $conf->product->dir_output . '/' . $object->ref; if (!is_dir($dir)) { return $photos; } $files = scandir($dir); foreach ($files as $file) { if (preg_match('/\.(jpg|jpeg|png|gif)$/i', $file)) { $path = $dir . '/' . $file; $type = pathinfo($path, PATHINFO_EXTENSION); $content = file_get_contents($path); $photos[] = [ 'name' => $file, 'src' => 'data:image/' . $type . ';base64,' . base64_encode($content) ]; } } return $photos; }