Public | Automated Build

Last pushed: 3 months ago
Short Description
Desktop Wallpaper generator.
Full Description

This project generates the current background image in the resolution needed for the computer making the request. What?? Why???

Description

This server takes assets and slaps them together to create a wallpaper image of the requested resolution. Because the wallpaper image is created on the fly, the wallpaper server can generate a wallpaper for any aspect ratio requested; even portrait (sideways) monitors.

There are three assets used:

  • Background: The background image of the wallpaper. This is currently just a single pixel of the green color that we want.
  • TopLeft: This is the an image we want in the top left; like the company logo.
  • BottomRight: This is an image we want in the bottom right; like support contact information.

Usage

The main issue presented iteself in OS X when the Lock Screen Wallpaper image had to fit the screen resolution because OS X wouldn't resize or stretch it as needed.

We also use it for Windows because we can only specify one file (via GPO) to force as the Lock Screen Wallpaper. Since logos stretch and stretched logos make VIPs sad ... we decided we needed to to be a little more creative with choosing the image for the Lock Screen Wallpaper. This server allows an unskewed image with the the exact resolution to be used for the Lock Screen Wallpaper.

Query String Parameters

See for yourself with two quick examples (please feel free to play; submit an issue when you break it):

By default, this will return a BMP; for windows.

However, OS X needs PNG with Alpha Channel:

Note: Only bmp and png are supported formats.

More Query String Parameters

Here's a list and quick desciption of all of the current Query String Parameters:

Parameter Name Default Value Expected Value(s)/Type Description
bg Background bg Check the /assets folder for possible images; supply the case-sensitive name without extension. This image will be stretch to the height and width needed to fill the background.
bl Bottom Left NULL Check the /assets folder for possible images; supply the case-sensitive name without extension. This image will be used in the appropriate corner.
blp Bottom Left Percentage 0 Should be a number less than or equal to 1. This is the percentage of the width of the Bottom Left image.
blm Bottom Left Margin Percentage 0 Should be a postive number less than or equal to 1. Two numbers can be supplied, seperated by a comma (no space). i.e.: .05 or .05,.07 This is the percentage of the width that will be used to apply a margin around the Bottom Left image. It works like CSS's margin shorthand property; however, only one or two values are supported.
br Bottom Right NULL Check the /assets folder for possible images; supply the case-sensitive name without extension. This image will be used in the appropriate corner.
brp Bottom Right Percentage 0 Should be a number less than or equal to 1. This is the percentage of the width of the Bottom Right image.
brm Bottom Right Margin Percentage 0 Should be a postive number less than or equal to 1. Two numbers can be supplied, seperated by a comma (no space). i.e.: .05 or .05,.07 This is the percentage of the width that will be used to apply a margin around the Bottom Right image. It works like CSS's margin shorthand property; however, only one or two values are supported.
f Format bmp bmp, png The format of the image.
h Height REQUIRED int The desired height of the image.
tl Top Left est-1890-UNT-University-of-North-Texas-white Check the /assets folder for possible images; supply the case-sensitive name without extension. This image will be used in the appropriate corner.
tlp Top Left Percentage .6 Should be a number less than or equal to 1. This is the percentage of the width of the Top Left image.
tlm Top Left Margin Percentage 0 Should be a postive number less than or equal to 1. Two numbers can be supplied, seperated by a comma (no space). i.e.: .05 or .05,.07 This is the percentage of the width that will be used to apply a margin around the Bottom Right image. It works like CSS's margin shorthand property; however, only one or two values are supported.
tr Top Right NULL Check the /assets folder for possible images; supply the case-sensitive name without extension. This image will be used in the appropriate corner.
trp Top Right Percentage 0 Should be a number less than or equal to 1. This is the percentage of the width of the Top Right image.
trm Top Right Margin Percentage 0 Should be a postive number less than or equal to 1. Two numbers can be supplied, seperated by a comma (no space). i.e.: .05 or .05,.07 This is the percentage of the width that will be used to apply a margin around the Bottom Right image. It works like CSS's margin shorthand property; however, only one or two values are supported.
w Width REQUIRED int The desired width of the image.

Cache

Cached requests are here; in case you're curious:

Note: Cached files are touched everytime they are accessed.
Note: Server time is in GMT.

Docker

This has been setup to run in Docker. Simply use git to clone this repo to the Docker server. Then, build and run the Docker image with docker-compose:

docker-compose up -d

Force a rebuild:

docker-compose build

Get a bash shell inside of the container (on the php service):

docker-compose exec php /bin/bash

Production

Add it to the swarm:

docker stack deploy -c wallpaper-server.yml wallpaper-server

Environment Variables

All of the query string parameters are available as an environment variable. Here's a couple of quick examples of setting the br, brm, and brp parameters via environment variables:

# The rest of this code block is one line
docker run -it -p 8080:80 -e WALLPAPER_BR=other_image -e WALLPAPER_BRP=.3 -e WALLPAPER_BRM=0 --rm wallpaper
environment:
  - WALLPAPER_BR=other_image
  - WALLPAPER_BRP=.3
  - WALLPAPER_BRM=0

Addtionally, there's one additional environment variable available:

Parameter Name Default Value Expected Value(s)/Type Description
WALLPAPER_README ReadMe https://github.com/UNT-CAS-ITS/Wallpaper-Server A URL. This is used to overwrite the error messages, in case you've forked this project and would prefer to point to it.

Note: Query string parameters (aka: GET parameters) will overwrite environment variable settings.

Docker Pull Command
Owner
vertigoray
Source Repository

Comments (0)