public function listFiles(array $paths)
    {
        $files  = array();
        $webDir = rtrim(realpath($this->webDir), '/');
        foreach ($paths as $path) {
            if (substr($path, 0, 1) != '/') {
                $path = sprintf('/%s', $path);
            }
            $realpath = realpath($webDir.$path);
            if ($realpath && strpos($realpath, $webDir) === 0) {
                $finder = Finder::create()->files()->name('/\.(?:gif|png|jpg|jpeg)$/i');
                foreach ($finder->in(realpath($webDir.$path)) as $img) {
                    /** @var \SplFileInfo $img */
                    $folder  = str_ireplace($webDir, '', pathinfo($img->__toString(), PATHINFO_DIRNAME));
                    $files[] = array(
                        'thumb'  => $folder.'/'.$img->getFilename(),
                        'image'  => $folder.'/'.$img->getFilename(),
                        'title'  => pathinfo($img->__toString(), PATHINFO_FILENAME),
                        'folder' => str_ireplace('/', ' &gt; ', str_ireplace('\\', '>', trim($folder, '/'))),
                    );
                }
            } else {
                throw new InvalidParameterException(
                    'The provided path is either invalid or outside of the public directory. '.
                    'Maybe you forgot to set the "kernel.web_dir" parameter.'
                );
            }
        }

        return $files;
    }