test inlining

This commit is contained in:
Bruno Rybársky 2024-02-04 10:33:54 +01:00
parent 67f07debea
commit 1e82eb9ecd

@ -9,6 +9,7 @@ function inlineLocalStylesFromHref($inputString) {
$href = isset($match[1]) ? $match[1] : $match[2]; $href = isset($match[1]) ? $match[1] : $match[2];
$fname = $_SERVER['DOCUMENT_ROOT'] . '/' . $href; $fname = $_SERVER['DOCUMENT_ROOT'] . '/' . $href;
echo "from $fname";
// Get the content of the local CSS file // Get the content of the local CSS file
$cssContent = file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/' . $href); $cssContent = file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/' . $href);
@ -24,7 +25,7 @@ function inlineLocalStylesFromHref($inputString) {
$base64Content = base64_encode($fileContent); $base64Content = base64_encode($fileContent);
// Create the inline data URI // Create the inline data URI
$dataUri = 'url("data:image/' . pathinfo($url, PATHINFO_EXTENSION) . ';base64,' . $base64Content . '")'; $dataUri = 'url("data:application/octet-stream;base64,' . $base64Content . '")';
return $dataUri; return $dataUri;
}, $cssContent); }, $cssContent);