# First time caller. trouble with capture image from ipcam

**URL:** <https://discourse.nodered.org/t/first-time-caller-trouble-with-capture-image-from-ipcam/19052>\
**Category:** General\
**Created:** [11 December 2019 23:28 UTC](https://discourse.nodered.org/t/first-time-caller-trouble-with-capture-image-from-ipcam/19052 "2019-12-11T23:28:20Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattk](https://avatars.discourse-cdn.com/v4/letter/m/76d3ee/32.png) [@mattk](https://discourse.nodered.org/u/mattk)\
**Post date:** [11 December 2019 23:28 UTC](https://discourse.nodered.org/t/first-time-caller-trouble-with-capture-image-from-ipcam/19052/1 "2019-12-11T23:28:20Z")

</div>

Hi all. Just introduced to node-red. 25 years in IT but not anything remotely related to programming, I'm a copy/paste guy when it comes to this, at best!

I have somehow, built the following but having trouble with the proper image capture

- raspberryPi 4 running latest node-red and mosquitto
- wemos d1 mini attached to driveway motion sensor. when motion is sensed, the wemos sends mqtt message to node red
- when node-red sees the mqtt payload of 'motion', it captures an image from an ipcamera.
- timestamp and captured image are put onto nodered dashboard

so I thought I had it, but realized that every time I refresh the dashboard, I just see current image from the ipcamera. so node-red obviously isn't 'capturing' an image, its just passing the URL through to the dashboard and I see the current image from camera in realtime, or at least thats what I think is happening.

any pointers in where to look? I'm new user so can't attach the flow json file, i'll post screenshot and assume I can post the code below here. What I would really like is

- last image is shown on UI with timestamp
- the last X images are shown as viewable links, with timestamp for each, so I can go back and view the last few.
- every time image is taken I get an email with that image and timestamp. i haven't tackled that yet, I want to fix the image capture first

I think I may be going about this incorrectly. Is the right way to do it to capture the image file, save it locally to the Pi, then have dynamic file listing built that shows each image 'entry'? or something similar to that.

thanks! be kind to a noob! 🙂

---

<div class="post-metadata">

**Author:** ![mattk](https://avatars.discourse-cdn.com/v4/letter/m/76d3ee/32.png) [@mattk](https://discourse.nodered.org/u/mattk)\
**Post date:** [11 December 2019 23:31 UTC](https://discourse.nodered.org/t/first-time-caller-trouble-with-capture-image-from-ipcam/19052/2 "2019-12-11T23:31:26Z")

</div>

```auto
[
    {
        "id": "66344843.4cef48",
        "type": "mqtt in",
        "z": "8cba898c.f9dff8",
        "name": "DrivewayMotionDetected",
        "topic": "driveway/motion",
        "qos": "2",
        "datatype": "auto",
        "broker": "e5102fc8.e43f8",
        "x": 150,
        "y": 280,
        "wires": [
            [
                "571b938b.bd857c",
                "b47a5cf4.d4845",
                "4a48525f.7fa57c"
            ]
        ]
    },
    {
        "id": "571b938b.bd857c",
        "type": "debug",
        "z": "8cba898c.f9dff8",
        "name": "MotionOn",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "x": 380,
        "y": 280,
        "wires": []
    },
    {
        "id": "b47a5cf4.d4845",
        "type": "function",
        "z": "8cba898c.f9dff8",
        "name": "motionTimestamp",
        "func": "msg.payload = msg.payload + \" - \" + new Date().toString();\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 410,
        "y": 220,
        "wires": [
            [
                "9edace0c.4737c"
            ]
        ]
    },
    {
        "id": "9edace0c.4737c",
        "type": "ui_text",
        "z": "8cba898c.f9dff8",
        "group": "a33c774b.319ac8",
        "order": 2,
        "width": 0,
        "height": 0,
        "name": "",
        "label": "Last Motion time",
        "format": "{{msg.payload}}",
        "layout": "row-spread",
        "x": 630,
        "y": 220,
        "wires": []
    },
    {
        "id": "4a48525f.7fa57c",
        "type": "http request",
        "z": "8cba898c.f9dff8",
        "name": "camera auth",
        "method": "GET",
        "ret": "bin",
        "paytoqs": false,
        "url": "http://192.168.199.55/tmpfs/auto.jpg",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "basic",
        "x": 390,
        "y": 360,
        "wires": [
            [
                "77bca07a.ef5a3"
            ]
        ]
    },
    {
        "id": "9c7ec7dd.81b0c8",
        "type": "ui_template",
        "z": "8cba898c.f9dff8",
        "group": "a33c774b.319ac8",
        "name": "showPic UI",
        "order": 1,
        "width": 0,
        "height": 0,
        "format": "<p> Status:\n<img width=\"800\" height=\"600\" src= {{msg.payload}} alt='Image not found' />\n</p>",
        "storeOutMessages": true,
        "fwdInMessages": false,
        "templateScope": "local",
        "x": 790,
        "y": 360,
        "wires": [
            []
        ]
    },
    {
        "id": "77bca07a.ef5a3",
        "type": "function",
        "z": "8cba898c.f9dff8",
        "name": "get pic from cam",
        "func": "msg.payload = 'http://192.168.199.55/tmpfs/auto.jpg';\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 590,
        "y": 360,
        "wires": [
            [
                "9c7ec7dd.81b0c8"
            ]
        ]
    },
    {
        "id": "e5102fc8.e43f8",
        "type": "mqtt-broker",
        "z": "",
        "name": "localhost:1883",
        "broker": "localhost:1883",
        "port": "1883",
        "clientid": "",
        "usetls": false,
        "compatmode": false,
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "willTopic": "",
        "willQos": "0",
        "willPayload": ""
    },
    {
        "id": "a33c774b.319ac8",
        "type": "ui_group",
        "z": "",
        "name": "Motion",
        "tab": "5dcb683f.0d5878",
        "disp": true,
        "width": 16,
        "collapse": false
    },
    {
        "id": "5dcb683f.0d5878",
        "type": "ui_tab",
        "z": "",
        "name": "Garage",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
] or paste code here

```

---

<div class="post-metadata">

**Author:** ![mattk](https://avatars.discourse-cdn.com/v4/letter/m/76d3ee/32.png) [@mattk](https://discourse.nodered.org/u/mattk)\
**Post date:** [11 December 2019 23:35 UTC](https://discourse.nodered.org/t/first-time-caller-trouble-with-capture-image-from-ipcam/19052/3 "2019-12-11T23:35:34Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/3/3706896035223dbf46cc1feca562c4f990cb4ae4.png)

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [12 December 2019 01:10 UTC](https://discourse.nodered.org/t/first-time-caller-trouble-with-capture-image-from-ipcam/19052/4 "2019-12-12T01:10:58Z")

</div>

Your flow is not importable. Take a read of [this thread](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506) that tells you what you need to do.and then eithor edit your post or repost your flow.

---

<div class="post-metadata">

**Author:** ![mattk](https://avatars.discourse-cdn.com/v4/letter/m/76d3ee/32.png) [@mattk](https://discourse.nodered.org/u/mattk)\
**Post date:** [12 December 2019 04:58 UTC](https://discourse.nodered.org/t/first-time-caller-trouble-with-capture-image-from-ipcam/19052/5 "2019-12-12T04:58:17Z")

</div>

thank you, I edited it, looks a lot better now!

---

<div class="post-metadata">

**Author:** ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)\
**Post date:** [12 December 2019 05:24 UTC](https://discourse.nodered.org/t/first-time-caller-trouble-with-capture-image-from-ipcam/19052/6 "2019-12-12T05:24:46Z")

</div>

There is a lot discussed around this (popular?) topic in various threads, you may also try the search function as well.  
Anyway, the concept is known to many around here. Without diving too deep right know, I just want to mention a few things;

- saving a lot of snapshots to the Pi's SD card is not healthy in the long run, you should have an external mounted disk or "sacrifice" a usb stick to avoid a system crash
- when you detect movement on your driveway, do you really want to have a notification even if it is a cat or another animal?

Myself and others are using AI to analys the image content and looking for specific objects like people. Only if a person is detected, you get a notification. As a notification service I use Telegram, fast accurate & reliable and you can attach images to the messages

---

<div class="post-metadata">

**Author:** ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)\
**Post date:** [12 December 2019 08:11 UTC](https://discourse.nodered.org/t/first-time-caller-trouble-with-capture-image-from-ipcam/19052/7 "2019-12-12T08:11:13Z")

</div>

You can try this:

> **[node-red-contrib-multipart-stream-decoder](https://www.npmjs.com/package/node-red-contrib-multipart-stream-decoder)**
>
> Node Red node for decoding multipart streams over http

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [12 December 2019 08:11 UTC](https://discourse.nodered.org/t/first-time-caller-trouble-with-capture-image-from-ipcam/19052/8 "2019-12-12T08:11:54Z")

</div>

Here's a description of something similar...

[InfraRed - the project that grew and grew](http://resources-area.co.uk/node-red-flows/it_grew_and_grew.pdf)

In this application the image from a Raspeberry Pi camera is sent, via FTP, to a server.  
A clever PHP script ([Single File PHP Gallery](http://sye.dk/sfpg/)) allows you to step through the stored images.

You might be able to apply some of these ideas/suggestions.

---

<div class="post-metadata">

**Author:** ![mattk](https://avatars.discourse-cdn.com/v4/letter/m/76d3ee/32.png) [@mattk](https://discourse.nodered.org/u/mattk)\
**Post date:** [13 December 2019 22:19 UTC](https://discourse.nodered.org/t/first-time-caller-trouble-with-capture-image-from-ipcam/19052/9 "2019-12-13T22:19:15Z")

</div>

great thank you, will take a look this weekend

---

<div class="post-metadata">

**Author:** ![Paulf007](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paulf007/32/26758_2.png) [@Paulf007](https://discourse.nodered.org/u/Paulf007)\
**Post date:** [19 November 2020 03:43 UTC](https://discourse.nodered.org/t/first-time-caller-trouble-with-capture-image-from-ipcam/19052/10 "2020-11-19T03:43:56Z")

</div>

Hello Dave  
I seen your thread a couple of times and had a look at the PDF writeup that you did. Inspired me a lot thanks.  
One silly question:  
I have manage to save the images to the static folder and can display them in the browser (in my case "[http://192.168.8.30:1880/slideshow/flatdvr2.jpg](http://192.168.8.30:1880/slideshow/flatdvr2.jpg)"). I copied the index.php file into the same folder where the images is located ([http://192.168.8.30:1880/slideshow/index.php](http://192.168.8.30:1880/slideshow/index.php)). But , now for the silly/stupid question , how do "activate" the php file. If I direct the browser to the index.php file it ask's me to save the file.

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [19 November 2020 06:43 UTC](https://discourse.nodered.org/t/first-time-caller-trouble-with-capture-image-from-ipcam/19052/11 "2020-11-19T06:43:59Z")

</div>

> [@Paulf007](#):
>
> I have manage to save the images to the static folder

If you mean the 'static' folder defined by the Node-RED 'settings.js' config file - I've not tried that out.  
Have you got PHP running on your Pi ??

In my project I FTP the images to a remote server that is running PHP. I've also got FTP and PHP running on one of my Raspberry Pi(es) and can FTP the images there as well (but not in the 'static' folder).

When I have some spare time I'll try using the 'static' folder and let you know the outcome.

Glad you enjoyed reading the tutorial.
