This is Dashing widget to include slide show on your dashboard or one of its pages.
##Usage
Make sure to install RMagick
gem to support image resizing. The widget also needs my slightly improved standard image widget. Put the slide_show.rb
file in your /jobs
folder and slide_show_settings.json
to /assets/config/
.
Make sure directory /assets/config
and /assets/images/slide_show
are accessible by Dashing user.
To include the widget in a dashboard, add the following snippet to the dashboard layout file:
<li data-row="1" data-col="1" data-sizex="4" data-sizey="2">
<div data-id="SlideShow" data-view="Image" data-width="100%"></div>
</li>
There are 2 scheduler jobs used:
First one gets randomized list of image files with pattern from source directory, resizes them to needed size and puts them to /assets/images/slide_show/<widget name>
. It is executed at 5:00 and 18:00.
Second randomly loops every 30 seconds through the files in /assets/images/slide_show/<widget name>
and sends event with random file URL
##Settings
Mount your images directory to any directory on your server to be accessible by Dashing user. Amend /assets/config/slide_show_settings.json
to have parameters specified.
There is no need to restart service if job is already running and settings file is amended.
Hey Brunas,
I faced a decent problem while trying to use your slideshow. Actually, the images did not slide through. Hence, I did some checking. You missed the array-operator in three lines, which causes the ... something.length to result in the size of "1". On the basis of this, the rand() function is called. It will also return "0". Therefore, the first image in the line will always be chosen. There won't be any slideshow.
Here are the lines of "slide_show.rb" you need to adopt:
line 88:
original: file = @files[widget][rand(@files.length)]
new: file = @files[widget][rand(@files[widget].length)]
line 92:
original: .... Dir.pwd+"/assets/images/slide_show/#{widget}", @files[widget][rand(@files.length)]),
new: .... Dir.pwd+"/assets/images/slide_show/#{widget}", file),
Apart from that, thanks for the widget. It really helps me a lot :) 👍