diff options
Diffstat (limited to 'utils/preload.php')
-rw-r--r-- | utils/preload.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/utils/preload.php b/utils/preload.php new file mode 100644 index 0000000..9e26956 --- /dev/null +++ b/utils/preload.php @@ -0,0 +1,25 @@ +<?php /* -*- Mode: php; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ + +function preload($cssfile) +{ + $css = file_get_contents($cssfile); + + // TODO: Check for @import and do recursive parsing +?> + + <div style="display: none;"> +<?php + preg_match_all("|url\((.+)\)|U", $css, $urls); + // print_r($urls); + $path = dirname($cssfile); + $imgs = array_unique($urls[1]); + +foreach($imgs as $_p) { + echo " <img alt=\"preload\" src=\"".$path . "/" . $_p."\"/>\n"; +} +?> +</div> +<?php +} + +?>
\ No newline at end of file |