added output image resize
[node-red-contrib-onvif.git] / onvif / snapshot.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<script type="text/x-red" data-template-name="ONVIF Snapshot">
    <div class="form-row">
        <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
        <input type="text" id="node-input-name" placeholder="Name">
    </div>
    <div class="form-row">
        <label for="node-input-url"><i class="fa fa-link"></i> IP Cam URL</label>
        <input type="text" id="node-input-url" placeholder="http://192.168.0.10:8080/onvif/device_service">
    </div>
    <div class="form-row">
        <label for="node-input-username"><i class="fa fa-user"></i> Username</label>
        <input type="text" id="node-input-username" placeholder="Username">
    </div>
    <div class="form-row">
        <label for="node-input-password"><i class="fa fa-key"></i> Password</label>
        <input type="text" id="node-input-password" placeholder="Password">
    </div>
    <div class="form-row">
        <label for="node-input-resize"><i class="fa fa-file-code-o"></i> Resize</label>
        <input type="text" id="node-input-resize" placeholder='{"width": 800}'>
    </div>
</script>
 
<script type="text/x-red" data-help-name="ONVIF Snapshot">
<h2>Inputs</h2>
<p>You can wire inject nodes to the input of this node and send the following in <code>msg.payload</code>.</p>
<table>
    <thead>
        <tr>
            <th>msg.payload</th>
            <th></th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><code>name</code></td>
            <td>IP camera name</td>
        </tr>
        <tr>
            <td><code>url</code></td>
            <td>IP camera URL</td>
        </tr>
        <tr>
            <td><code>username</code></td>
            <td>IP camera username</td>
        </tr>
        <tr>
            <td><code>password</code></td>
            <td>IP camera password</td>
        </tr>
        <tr>
            <td><code>resize.width</code></td>
            <td>Resize image by width</td>
        </tr>
        <tr>
            <td><code>resize.height</code></td>
            <td>Resize image by height</td>
        </tr>
    </tbody>
</table>
 
<h2>Output</h2>
<table>
    <thead>
        <tr>
            <th>msg.payload</th>
            <th></th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><code>image.base64</code></td>
            <td>Base64 encoded image</td>
        </tr>
        <tr>
            <td><code>image.binary</code></td>
            <td>Binary image</td>
        </tr>
    </tbody>
</table>
</script>
 
<script type="text/javascript">
    RED.nodes.registerType("ONVIF Snapshot", {
        category: "ONVIF",
        color: "#91d2f7",
        defaults: {
            name: {value: ""},
            url: {value: "", required: true},
            username: {value: ""},
            password: {value: ""}
        },
        inputs: 1,
        outputs: 1,
        icon: "onvif-snapshot.png",
        label: function() {
            return this.name || this.url || this.type;
        },
        labelStyle: function() {
            return this.name ? "node_label_italic" : "";
        },
        paletteLabel: "Snapshot",
        oneditprepare: function() {
        },
        oneditsave: function() {
        }
    });
</script>
 
comments