Unsplash Images as Background option #54

Closed
opened 2026-02-20 11:14:52 -05:00 by deekerman · 2 comments
Owner

Originally created by @Futos on GitHub (Feb 12, 2018).

Maybe would be cool to have a option to choose a picture from Unsplash or set a random Image

https://source.unsplash.com/

Full API:
https://unsplash.com/developers

Originally created by @Futos on GitHub (Feb 12, 2018). Maybe would be cool to have a option to choose a picture from Unsplash or set a random Image https://source.unsplash.com/ **Full API:** https://unsplash.com/developers
Author
Owner

@GammaPi commented on GitHub (Mar 27, 2020):

@KodeStar @anoma @Futos

There's a quick and dirty solution:

  1. Find this file /var/www/localhost/heimdall/app/Providers/AppServiceProvider.php
  2. Find the following code
$alt_bg = '';
            if($bg_image = Setting::fetch('background_image')) {
                $alt_bg = ' style="background-image: url(/storage/'.$bg_image.')"';
            } 
  1. Modift alt_bg to an image api such as unsplash/bing whatever...
 $alt_bg = '';
            if($bg_image = Setting::fetch('background_image')) {
                // $alt_bg = ' style="background-image: url(/storage/'.$bg_image.')"';
                $alt_bg = ' style="background-image: url(https://source.unsplash.com/collection/962362/daily)"';
            }  

4.Refresh the page

@GammaPi commented on GitHub (Mar 27, 2020): @KodeStar @anoma @Futos There's a quick and dirty solution: 1. Find this file /var/www/localhost/heimdall/app/Providers/[AppServiceProvider.php](https://github.com/linuxserver/Heimdall/blob/994961de543522b140d801a1b9ec916a82baa3df/app/Providers/AppServiceProvider.php#L98) 2. Find the following code ``` $alt_bg = ''; if($bg_image = Setting::fetch('background_image')) { $alt_bg = ' style="background-image: url(/storage/'.$bg_image.')"'; } ``` 3. Modift alt_bg to an image api such as unsplash/bing whatever... ``` $alt_bg = ''; if($bg_image = Setting::fetch('background_image')) { // $alt_bg = ' style="background-image: url(/storage/'.$bg_image.')"'; $alt_bg = ' style="background-image: url(https://source.unsplash.com/collection/962362/daily)"'; } ``` 4.Refresh the page
Author
Owner

@apiontek commented on GitHub (May 27, 2020):

Just as an additional trick, to make sure the background properly fills/fits when the random image is too big or too small, add the css background-size: cover; so it looks like:

$alt_bg = '';
    if($bg_image = Setting::fetch('background_image')) {
        // $alt_bg = ' style="background-image: url(/storage/'.$bg_image.')"';
        $alt_bg = ' style="background-image: url(https://source.unsplash.com/daily); background-size: cover;"';
    }
@apiontek commented on GitHub (May 27, 2020): Just as an additional trick, to make sure the background properly fills/fits when the random image is too big or too small, add the css `background-size: cover;` so it looks like: ```php $alt_bg = ''; if($bg_image = Setting::fetch('background_image')) { // $alt_bg = ' style="background-image: url(/storage/'.$bg_image.')"'; $alt_bg = ' style="background-image: url(https://source.unsplash.com/daily); background-size: cover;"'; } ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Heimdall-linuxserver#54
No description provided.