Add Unsplash background image support

This commit is contained in:
Dale Davies
2022-06-03 22:41:28 +01:00
parent 395c17ecdd
commit ad322ba0c0
13 changed files with 1030 additions and 26 deletions

View File

@@ -10,10 +10,15 @@
require __DIR__ .'/vendor/autoload.php';
$config = new Jump\Config();
$backgroundimgfile = (new Jump\Background($config))->get_random_background_file();
$blur = floor((int)$config->get('bgblur', false) / 100 * 15);
$brightness = (int)$config->get('bgbright', false) ? (int)$config->get('bgbright', false) / 100 : 1;
$bgurlstring = '';
if ($config->get('unsplashapikey', false) == null) {
$backgroundimgfile = (new Jump\Background($config))->get_random_background_file();
$bgurlstring = 'background-image: url("'.$backgroundimgfile.'");';
}
header('Content-Type: text/css');
echo '.background {background-image: url("'.$backgroundimgfile.'");filter: brightness('.$brightness.') blur('.$blur.'px);}';
echo '.background {'.$bgurlstring.'filter: brightness('.$brightness.') blur('.$blur.'px);}';