Add image generating for background images
This commit is contained in:
parent
c4867a83dd
commit
3953a4eb2a
|
@ -16,7 +16,7 @@ if (file_exists("site.json")) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (preg_match('/\.(?:jpg|png|webp|css|ico|scss|js|ttf|woff|txt)/', $_SERVER["REQUEST_URI"])) {
|
||||
if (preg_match('/\.(?:jpg|png|webp|css|ico|js|ttf|woff|txt)/', $_SERVER["REQUEST_URI"])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -139,6 +139,9 @@ die();
|
|||
function img_src($src, $root = "" ) {
|
||||
if (empty($root)) $root = $_SERVER['REQUEST_URI'];
|
||||
if ($root == "/") $root = "";
|
||||
|
||||
if (substr($root, -1) == '/') $root = substr($root, 0, -1);
|
||||
|
||||
if ($src[0] != '/') {
|
||||
$write = "$root/$src";
|
||||
} else $write = $src;
|
||||
|
@ -211,7 +214,7 @@ function make_bkgd_img($src, $q=80) {
|
|||
$pe = ltrim($pwebp, '/');
|
||||
$we = ltrim($p, '/');
|
||||
|
||||
return "background-image: image-set(url($pe) 1x, url($we) 1x)";
|
||||
return "background-image: url($pe); background-image: -webkit-image-set(url($pwebp) 1x, url($p) 1x)";
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue