/** * Find an asset file relative path web ready * * @param string $file_path The file path to search * @return string The relative web ready path for this file, null otherwise */ public function findAsset($file_path) { $real_path = $this->findRealPath($file_path); if ($real_path) { return trim(FilesystemHelper::resolveRelatedPath($this->web_root_path, $real_path), '/'); } return null; }
/** * Build a web path ready to use in HTML * * This will build a relative path related to the object `$document_root` and ready-to-use * in HTML attributes. It uses the "smart resolving" feature of the `Library\Helper\Filesystem` * class: path is returned relative to `$document_root` even if it is not in it in the * filesystem. * * @param string $path The path to transform * @return string * @see \Library\Helper\Filesystem::resolveRelatedPath() */ public static function buildWebPath($path) { $_this = self::getInstance(); return trim(FilesystemHelper::resolveRelatedPath($_this->getDocumentRoot(), realpath($path)), '/'); }