private function findImage($src, $tag, Content $file, $callback) { //for protocol relative or http requests : keep the original one if (substr($src, 0, strlen('http')) === 'http' || substr($src, 0, strlen('//')) === '//') { return $src; } //Get the path to the file, relative to the root of the documentation $url = DauxHelper::getCleanPath(dirname($file->getUrl()) . '/' . $src); //Get any file corresponding to the right one $file = DauxHelper::getFile($this->tree, $url); if ($file === false) { return false; } $result = $callback($src, $this->getAttributes($tag), $file); return $result ?: $src; }