public static function normalizeCssContent($content, array $fileInfo) { preg_match_all("@url\\s*\\(\\s*[\"']?(.*?)[\"']?\\s*\\)@is", $content, $matches); $hostUrl = Tool::getHostUrl(); if (is_array($matches[0])) { foreach ($matches[0] as $key => $value) { $fullMatch = $matches[0][$key]; $path = $matches[1][$key]; if ($path[0] == '/') { $imageUrl = $hostUrl . $path; } else { $imageUrl = dirname($fileInfo['fileUrlNormalized']) . "/{$path}"; $netUrl = new \Net_URL2($imageUrl); $imageUrl = $netUrl->getNormalizedURL(); } $content = str_replace($fullMatch, " url(" . $imageUrl . ") ", $content); } } return $content; }