/** * Returns the cached path, after executing the asset twig function * * @param string $path Path of the source file * @param string $format Imbundle format string * * @return mixed */ public function imResize($path, $format) { // Remove extra whitespaces $path = trim($path); $separator = ""; // Transform absolute url to custom url like : http/ or https/ or simply / if (strpos($path, "http://") === 0 || strpos($path, "https://") === 0 || strpos($path, "//") === 0) { $path = str_replace(array("://", "//"), "/", $path); } elseif (strpos($path, "/") === 0) { // If the path started with a slash, we will add it at the start of the path result $separator = "/"; } // Remove the first slash, as we add it manually $path = ltrim($path, '/'); return $separator . $this->manager->getCachePath() . '/' . $format . '/' . $path; }