2.0.0-dev.1 • Published 6 years ago

mozaik-ext-image v2.0.0-dev.1

Weekly downloads
25
License
MIT
Repository
github
Last release
6 years ago

Mozaïk image extension

Show image in a widget. Supports also refreshing the image in timely bases, making it handy for webcams, daily comics or kittens 😊

📢   NOTE See mozaik-2 branch for Mozaik 2 compatible extension

preview

Table of contents

Setup

  • Install extension: npm i -S mozaik-ext-image
  • Register widget:
    // register_extensions.js
    import image from 'mozaik-ext-image'
    Registry.addExtensions({ image, ... })
  • Add widget(s) in dashboard config.yml (see Widget X specific documentation)

Widget: image.Image

Show the image in widget.

parameters

keyrequireddescription
urlyesURL to an image.
titlenoTitle to show in widget. Defaults to no header
refreshIntervalnoImage refreshing interval in milliseconds (refreshing is done automatically by adding/incrementing counter attribute). Defaults to no refresh. Example: 3000
backgroundSizenoImage size (set as background image). Defaults to 'cover'
backgroundColornoBackground color, handy with transparent images. Defaults to parent color
backgroundPositionnoBackground position, defaults to 'center center'

usage

  • Register the widget
  • Add widget in dashboard configuration:

    widgets:
      -
        extension:          image
        widget:             Image
        url:                https://picsum.photos/200/300/?random
        refreshInterval:    10000
        backgroundSize:     cover
        backgroundPosition: center -7vh
        title:              Random image
        columns:            1
        rows:               1
        x:                  0
        y:                  0

Widget: image.Svg

Show (and optionally animate the path drawing) the SVG image in a widget.

parameters

keyrequireddescription
urldependsURL to an image. Either this or content needs to be defined. NOTE: Because of the browser CORS rules, an extension client is needed to download the file in temp folder. This is done automatically once registered
contentdependsSVG image contents. Either this or url needs to be defined. Remember to use > to note multiline text
titlenoTitle to show in widget. Defaults to no header
animationnoAnimation style if wanted to be used. Options: delayed, sync, oneByOne, script, scenario or scenario-sync. Defaults to empty which mean no animation. See vivus documentation for more info
durationnoAnimation duration in frames. Defaults to 200

usage

  • Register the widget
  • Add widget in dashboard configuration:

    widgets:
      -
        extension:          image
        widget:             Svg
        content: >
          <svg>
            <path ...>
            <path data-ignore="true" ...>
          </svg>
        title:              Random image
        animation:          oneByOne
        speed:              100
        columns:            1
        rows:               1
        x:                  0
        y:                  0

Changelog

2.0.0-dev

  • Added for Mozaik 2.x
  • Added new widget: image.Svg
  • Changed refreshInterval unit from seconds to milliseconds
  • Changed title default value to no header

0.4.0

  • Added support for background styles

0.2.2

  • Updated package links

0.2.1

  • Improved documentation

0.2.0

  • Added double buffering when refreshing image

0.1.0

  • First public release

License

Distributed under the MIT license