1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-06 14:46:36 +02:00

Inline GIF to CSS

This commit is contained in:
Jakub Vrana
2025-03-29 08:44:56 +01:00
parent 5b329ae720
commit 6cf3d5d2b8
7 changed files with 8 additions and 9 deletions

View File

@@ -204,11 +204,8 @@ if (!$translations) {
function minify_css($file) {
global $project;
if ($project == "editor") {
$file = preg_replace('~.*\.gif.*~', '', $file);
$file = preg_replace('~.*\.url\(.*~', '', $file);
}
$file = preg_replace_callback('~url\((\w+\.(gif))\)~', function ($match) {
return "url(data:image/$match[2];base64," . base64_encode(file_get_contents(__DIR__ . "/adminer/static/$match[1]")) . ")";
}, $file);
return lzw_compress(preg_replace('~\s*([:;{},])\s*~', '\1', preg_replace('~/\*.*?\*/\s*~s', '', $file)));
}