Show a slideshow of images in the background. Great for a photo frame from instead of a mirror.
The MMM-BackgroundSlideshow
module is designed to display images fullscreen, one at a time on a fixed interval, from one or many directories. These images can be shown in order or at random, one directory at a time or all at time. The images can transition from one to the other and be shown with no edge (cover) or the enter image(contain).
Based on MMM-ImageSlideshow.
This module requires no special dependencies. The only requirement is that the image directories you path to are fixed paths accessible to the Magic Mirror instance.
This module will take in a list of directory paths, one or more, containing image files. The module will display those images in either alphabetical or random order, across either each path one at time or across all the paths at once. Once all the images have been shown, it will loop back and start again.
Extra configurations include setting the amount of time an image is shown for, selecting which file extensions are valid, the transition speed from one image to another, the background sizing, whether or not to animate the transition from one to the other, the gradient used to make the text more readable, and the gradient opacity.
Use Git to download. Make sure Git is installed on your system. In the command line/terminal, go to the modules directory of the your Magic Mirror install. run: 'git clone https://github.com/darickc/MMM-BackgroundSlideshow.git'. The advantage of using Git is when there is an update, you can run 'git pull' and it will pull down all the updates. Magic Mirror can even let you know when there are updates.
Or
Download the zip file https://github.com/darickc/MMM-BackgroundSlideshow/archive/master.zip. Unzip contents into the modules directory of your Magic Mirror install. Rename the 'MMM-BackgroundSlideshow-master' folder to 'MMM-BackgroundSlideshow'.
Once downloaded, install dependencies:
cd ~/MagicMirror/modules/MMM-BackgroundSlideshow
npm install
Add the module to the modules array in the config/config.js
file:
modules: [
{
module: 'MMM-BackgroundSlideshow',
position: 'fullscreen_below',
config: {
imagePaths: ['modules/MMM-BackgroundSlideshow/exampleImages/'],
transitionImages: true,
randomizeImageOrder: true,
},
},
];
I also recommend adding the following to the custom.css to make the text a little brighter:
.normal,
.dimmed,
header,
body {
color: #fff;
}
The following notifications can be used:
Notification | Description |
---|---|
BACKGROUNDSLIDESHOW_UPDATE_IMAGE_LIST |
Reload images list and start slideshow from first image. Works best when sorted by modified date descending. |
BACKGROUNDSLIDESHOW_NEXT |
Change to the next image, restart the timer for image changes only if already running |
BACKGROUNDSLIDESHOW_PREVIOUS |
Change to the previous image, restart the timer for image changes only if already running |
BACKGROUNDSLIDESHOW_PAUSE |
Pause the timer for image changes |
BACKGROUNDSLIDESHOW_PLAY |
Change to the next image and start the timer for image changes |
BACKGROUNDSLIDESHOW_URL |
Show an image by passing an object with a URL. Include resume=true to continue slideshow after displaying image, otherwise the image will display until another notification such as BACKGROUNDSLIDESHOW_PLAY.
Example payload: {url:'url_to_image', resume: true} |
BACKGROUNDSLIDESHOW_URLS |
Pass in a list of URLs to display in the background. To continue showing photos, pass in an empty array or no payload.
Example payload: {urls:['url_to_image', 'url_to_image']} |
The following properties can be configured:
Option | Description |
---|---|
imagePaths |
Array value containing strings. Each string should be a path to a directory where image files can be found. Example: ['modules/MMM-BackgroundSlideshow/exampleImages/']
This value is REQUIRED |
excludePaths |
Array value containing strings. When scanning subdirectories for
images, directories with these names will be ignored. Example: ['@eaDir']
Default value: ['@eaDir']
This value is OPTIONAL |
slideshowSpeed |
Integer value, the length of time to show one image before switching to the next, in milliseconds. Example: 6000 for 6 seconds
Default value: 10000 or 10 seconds
This value is OPTIONAL |
randomizeImageOrder |
Boolean value, if true will randomize the order of the images, otherwise use sortImagesBy and sortImagesDescending sorting by filename. Example: true
Default value: false
This value is OPTIONAL |
sortImagesBy |
String value, determines how images are sorted. Possible values are: name (by file name), created (by file created date), modified (by file
modified date). Only used if randomizeImageOrder is set to false. Example: created
Default value: name
This value is OPTIONAL |
sortImagesDescending |
Boolean value, if true will sort images in descending order, otherwise in ascending order. Only used if randomizeImageOrder is set to false. Example: true
Default value: false
This value is OPTIONAL |
recursiveSubDirectories |
Boolean value, if true it will scan all sub-directories in the imagePaths. Example: true
Default value: false
This value is OPTIONAL |
validImageFileExtensions |
String value, a list of image file extensions, separated by commas, that should be included. Files found without one of the extensions will be ignored. Example: 'png,jpg'
Default value: 'bmp,jpg,jpeg,gif,png'
This value is OPTIONAL |
showImageInfo |
Boolean value, if true a div containing the currently displayed image information will be shown. Example: true
Default value: false
This value is OPTIONAL |
imageInfoLocation |
String value, determines which corner of the screen the image info div should be displayed in. Possible values are: bottomRight, bottomLeft, topLeft, topRight Example: topLeft
Default value: bottomRight
This value is OPTIONAL |
imageInfo |
String value, a list of image properties to display in the image info div, separated by commas. Possible values are : date (EXIF date from image), name (image name).
For the iamge name, the relative path from that defined in imagePaths is displayed if the recursiveSubDirectories option is set to true. Example: date,name
Default value: name
This value is OPTIONAL |
transitionSpeed |
Transition speed from one image to the other, transitionImages must be true. Must be a valid css transition duration. Example: '2s'
Default value: '1s'
This value is OPTIONAL |
showProgressBar |
Boolean value, if true a progress bar indicating how long till the next image is
displayed is shown. Example: true
Default value: false
This value is OPTIONAL |
backgroundSize |
The sizing of the background image. Values can be: cover: Resize the background image to cover the entire container, even if it has to stretch the image or cut a little bit off one of the edges. contain: Resize the background image to make sure the image is fully visible Example: 'contain'
Default value: 'cover'
This value is OPTIONAL |
backgroundPosition |
Determines where the background image is placed if it doesn't fill the whole screen (i.e. backgroundSize is 'contain'). Module already defaults to 'center', so the most useful options would be: 'top' 'bottom' 'left' or 'right'. However, any valid value for CSS background-position could be used. Example: 'top'
Default value: 'center'
This value is OPTIONAL |
transitionImages |
Transition from one image to the other (may be a bit choppy on slower devices, or if the images are too big). Example: true
Default value: false
This value is OPTIONAL |
gradient |
The vertical gradient to make the text more visible. Enter gradient stops as an array. Example: [
"rgba(0, 0, 0, 0.75) 0%",
"rgba(0, 0, 0, 0) 40%"
]
Default value: [
"rgba(0, 0, 0, 0.75) 0%",
"rgba(0, 0, 0, 0) 40%",
"rgba(0, 0, 0, 0) 80%",
"rgba(0, 0, 0, 0.75) 100%"
]
This value is OPTIONAL |
horizontalGradient |
The horizontal gradient to make the text more visible. Enter gradient stops as an array. Example: [
"rgba(0, 0, 0, 0.75) 0%",
"rgba(0, 0, 0, 0) 40%"
]
Default value: [
"rgba(0, 0, 0, 0.75) 0%",
"rgba(0, 0, 0, 0) 40%",
"rgba(0, 0, 0, 0) 80%",
"rgba(0, 0, 0, 0.75) 100%"
]
This value is OPTIONAL |
gradientDirection |
The direction of the gradient Example: 'horizontal'
Default value: 'vertical'
Possible values: 'vertical', 'horizontal', 'both'
This value is OPTIONAL |
backgroundAnimationEnabled |
Boolean value, if set to true the background will scroll if the picture is larger than the screen size (e.g. for panaramic pictures). The picture will either scroll vertically or horizontally depending on which dimension extends beyond the screen size.
Note: For this to work, backgroundSize must be set to cover. Example: true
Default value: false
This value is OPTIONAL |
transitions |
Array value containing strings defining what transitions to perform.
Note: transitionImages must be set to true. Example: ['opacity', 'slideFromLeft']
Default value: ['opacity', 'slideFromRight', 'slideFromLeft', 'slideFromTop', 'slideFromBottom', 'slideFromTopLeft', 'slideFromTopRight', 'slideFromBottomLeft', 'slideFromBottomRight', 'flipX', 'flipY']
Possible values: 'opacity', 'slideFromRight', 'slideFromLeft', 'slideFromTop', 'slideFromBottom', 'slideFromTopLeft', 'slideFromTopRight', 'slideFromBottomLeft', 'slideFromBottomRight', 'flipX', 'flipY'
This value is OPTIONAL |
transitionTimingFunction |
CSS timing function used with transitions.
Note: transitionImages must be set to true. Example: 'ease-in
Default value: 'cubic-bezier(.17,.67,.35,.96)'
Possible values: 'ease', 'linear', 'ease-in', 'ease-out', 'ease-in-out', 'cubic-bezier(n,n,n,n)'
This value is OPTIONAL |
animations |
Array value containing strings defining what animations to perform.
Note: backgroundAnimationEnabled must be set to true. Example: 'ease-in
Default value: ['slide', 'zoomOut', 'zoomIn']
Possible values: 'slide', 'zoomOut', 'zoomIn'
This value is OPTIONAL |
changeImageOnResume |
Should the image be changed in the moment the module resumes after it got hidden?
Example: true
Default value: false
This value is OPTIONAL |