# \[APP\]\[Pro\] Image Poster - Upload Image Token's to your website

**URL:** <https://community.homey.app/t/app-pro-image-poster-upload-image-tokens-to-your-website/32904>\
**Category:** Apps\
**Tags:** app, homey-pro\
**Created:** [July 28, 2020, 9:03am UTC](https://community.homey.app/t/app-pro-image-poster-upload-image-tokens-to-your-website/32904 "2020-07-28T09:03:43Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ludvig](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ludvig/32/129091_2.png) [@Ludvig](https://community.homey.app/u/Ludvig)\
**Post date:** [July 28, 2020, 9:03am UTC](https://community.homey.app/t/app-pro-image-poster-upload-image-tokens-to-your-website/32904/1 "2020-07-28T09:03:43Z")

</div>

![large](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/4/5/4524438fedcc610ff2c3a3013ce8883281e95850.png)

## Description

Adds support for posting Image Token’s to a web site. Example use is for storing camera images on a web server.

## Usage

1. Add a flow Send a Image
2. Add the Image token
3. Add a URL
4. Run and check the server

## URL Receiver

You need to create a page on the “other side” that can receive a Form POST. Image will be stored with the ID “image”. Here you can find a simple [example](https://github.com/ludvigaldrin/com.svipler.athom.imageposter/blob/master/example/sendImage.php) Upload it to your server and create a folder named images. Then point it out from the Flow e.g. [http://yoururl.com/sendImage.php](http://yoururl.com/sendImage.php) There is some simple logging done.

If you need a simple Gallery this one can be used: [Simple Gallery](http://sye.dk/sfpg/)

## Links:

- [Image Poster app](https://homey.app/a/com.svipler.athom.imageposter/)
- [Image Poster app Github repository](https://github.com/ludvigaldrin/com.svipler.athom.imageposter)

## Supported devices

All devices that can post a [Image Token](https://apps-sdk-v2.developer.athom.com/tutorial-Flow-Tokens-Image.html)

## Supported Languages:

- English

---

<div class="post-metadata">

**Author:** ![DieJan](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/diejan/32/23130_2.png) [@DieJan](https://community.homey.app/u/DieJan)\
**Post date:** [July 29, 2020, 8:57am UTC](https://community.homey.app/t/app-pro-image-poster-upload-image-tokens-to-your-website/32904/2 "2020-07-29T08:57:07Z")

</div>

I gave the app a try, but it doesn’t seem to work completely. I have a PHP file on my web server ready to receive IMG files. I tested this PHP file through another method so I’m 99% sure it should work with this app. I made some logging on this website (like in your example) to check if something happened.

When I sent for example the last snapshot of my Ring doorbell with this app, I can see the action card is busy for approx. 2 seconds and after that shows a green checkmark. But it doesn’t trigger the PHP file. Even the log shows not a single entry (no success nor any error).

-edit: if you want, I can send you a diagnostic report-

---

<div class="post-metadata">

**Author:** ![DieJan](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/diejan/32/23130_2.png) [@DieJan](https://community.homey.app/u/DieJan)\
**Post date:** [July 30, 2020, 5:02am UTC](https://community.homey.app/t/app-pro-image-poster-upload-image-tokens-to-your-website/32904/3 "2020-07-30T05:02:03Z")

</div>

Now that I’ve tested it a little bit more, I can conclude that it doesn’t seem to work for big(?) images. Snapshots from my Ring doorbell are not sent with this app, while smaller images are sent to my PHP and stored succesfully. Is there some known limitation to sending large files?

---

<div class="post-metadata">

**Author:** ![Ludvig](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ludvig/32/129091_2.png) [@Ludvig](https://community.homey.app/u/Ludvig)\
**Post date:** [August 1, 2020, 11:29am UTC](https://community.homey.app/t/app-pro-image-poster-upload-image-tokens-to-your-website/32904/4 "2020-08-01T11:29:45Z")

</div>

Hmm, have just tried with the images from my camera and I guess they are quite small. There is a known PHP settings that limits uploads to a PHP page to 2MB. Maybe it is this setting hitting the limit? There is a check you can do in the sample code I have that you can just add to your:

> if ($file\_size \> 2097152) {  
> $errors = ‘File size must be exactly 2 MB’;  
> }

You can change this in your php.ini file: [How to Set the PHP Maximum Upload File Size](https://www.a2hosting.com/kb/developer-corner/php/using-php.ini-directives/php-maximum-upload-file-size#:~:text=By%20default%2C%20the%20maximum%20upload,the%20upload_max_filesize%20and%20post_max_size%20directives).

Maybe thats the issue?

---

<div class="post-metadata">

**Author:** ![mfanafuthi](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/mfanafuthi/32/47854_2.png) [@mfanafuthi](https://community.homey.app/u/mfanafuthi)\
**Post date:** [December 13, 2021, 9:49am UTC](https://community.homey.app/t/app-pro-image-poster-upload-image-tokens-to-your-website/32904/5 "2021-12-13T09:49:43Z")

</div>

i just tried the App with that example PHP-Script on two different Server and with nearly every image i have in Homey available.  
The result is always the same. The PHP-Script gets called but no image is send. The Log says “Error: No Image attached”.

Any suggestions whats going wrong?

---

<div class="post-metadata">

**Author:** ![Ludvig](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ludvig/32/129091_2.png) [@Ludvig](https://community.homey.app/u/Ludvig)\
**Post date:** [December 13, 2021, 10:12am UTC](https://community.homey.app/t/app-pro-image-poster-upload-image-tokens-to-your-website/32904/6 "2021-12-13T10:12:26Z")

</div>

Hmm. Strange. Just tried to make sure and my camera motion image are uploaded to my server without a problem. Im running it on my webhost with PHP 7.4 no special configurations or anything. Running the latest Homey version.

This is straight from my PHP file. Im

```auto
<?php

ini_set("log_errors", 1);
ini_set("error_log", "sendImage-error.log");

$id = uniqid();
$file = 'sendImage-log.txt';
file_put_contents($file, "\n" . date("h:i:sa") . " (" . $id . ") " . "-> Start Receive", FILE_APPEND | LOCK_EX);

if (isset($_FILES['image'])) {
    $errors = array();

    $file_size = $_FILES['image']['size'];
    $file_tmp = $_FILES['image']['tmp_name'];
    $file_type = $_FILES['image']['type'];
    $file_ext = strtolower(end(explode('.', $_FILES['image']['name'])));

    $file_name = time() . "-" . $id . "." . $file_ext;

    $extensions = array("jpeg", "jpg", "png");

    if (in_array($file_ext, $extensions) === false) {
        $errors[] = "extension not allowed, please choose a JPEG or PNG file.";
    }
    if (empty($errors) == true) {
        move_uploaded_file($file_tmp, "images/" . $file_name);
        file_put_contents($file, "\n" . date("h:i:sa") . " (" . $id . ") " . "-> Success: File Uploaded: " . $file_name, FILE_APPEND | LOCK_EX);
        echo "Success";
    } else {
        file_put_contents($file, "\n" . date("h:i:sa") . " (" . $id . ") " . "-> Error: " . $errors, FILE_APPEND | LOCK_EX);
        echo "Error";
    }
} else {
    file_put_contents($file, "\n" . date("h:i:sa") . " (" . $id . ") " . "-> Error: No Image attached", FILE_APPEND | LOCK_EX);
    echo "Error";
}

file_put_contents($file, "\n" . date("h:i:sa") . " (" . $id . ") " . "-> End Receive", FILE_APPEND | LOCK_EX);

```

---

<div class="post-metadata">

**Author:** ![Ludvig](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ludvig/32/129091_2.png) [@Ludvig](https://community.homey.app/u/Ludvig)\
**Post date:** [December 13, 2021, 10:13am UTC](https://community.homey.app/t/app-pro-image-poster-upload-image-tokens-to-your-website/32904/7 "2021-12-13T10:13:12Z")

</div>

Maybe your files are too big? You can add the check mentioned above.

---

<div class="post-metadata">

**Author:** ![mfanafuthi](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/mfanafuthi/32/47854_2.png) [@mfanafuthi](https://community.homey.app/u/mfanafuthi)\
**Post date:** [December 14, 2021, 1:45pm UTC](https://community.homey.app/t/app-pro-image-poster-upload-image-tokens-to-your-website/32904/8 "2021-12-14T13:45:36Z")

</div>

It seems that the problem is a misconfiguration of my server. I could not realy find out whats the problem  
Anyway i just switch to a different server and now everything is working fine.  
Thank you for your support.

---

<div class="post-metadata">

**Author:** ![Ludvig](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ludvig/32/129091_2.png) [@Ludvig](https://community.homey.app/u/Ludvig)\
**Post date:** [December 15, 2021, 6:23am UTC](https://community.homey.app/t/app-pro-image-poster-upload-image-tokens-to-your-website/32904/9 "2021-12-15T06:23:48Z")

</div>

Sweet

---

<div class="post-metadata">

**Author:** ![Gisle\_Johnsen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/gisle_johnsen/32/9720_2.png) [@Gisle\_Johnsen](https://community.homey.app/u/Gisle_Johnsen)\
**Post date:** [March 7, 2022, 12:15pm UTC](https://community.homey.app/t/app-pro-image-poster-upload-image-tokens-to-your-website/32904/10 "2022-03-07T12:15:09Z")

</div>

Hello and thank you for making this app.  
I am using Image grabber to get snap from camera:

> **[Image Grabber](https://homey.app/no-no/app/image.grabber/Image-Grabber/)**
>
> Input the URL to an image to grab it as a Homey image token. You can use this token, for example, with the Telegram app or email-sender app

And Image poster to send to my server.  
It pushes the snapshot sucsessfully to my phone.

But I am getting this error:

```auto
10:11:59am (6223295f4169e) -> Start Receive
10:11:59am (6223295f4169e) -> Error: No Image attached
10:11:59am (6223295f4169e) -> End Receive

```

This is the flow:  
[https://homey.app/no-no/flow/HQAMpZ/](https://homey.app/no-no/flow/HQAMpZ/)

On the server end I have put sendImage.php from you in folder:  
`/Ringeklokke`  
and made subfolder  
`/images`

This is done on a synology server under `WEB/` section.  
It writes the log file, but as mentioned above an error that image is not attached.

---

<div class="post-metadata">

**Author:** ![John\_Stelten](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/john_stelten/32/18095_2.png) [@John\_Stelten](https://community.homey.app/u/John_Stelten)\
**Post date:** [December 11, 2022, 11:25am UTC](https://community.homey.app/t/app-pro-image-poster-upload-image-tokens-to-your-website/32904/11 "2022-12-11T11:25:29Z")

</div>

Have a strange issue/error after working for weeks without any problems!

Error: Only absolute URLs are supported

 ![CleanShot 2022-12-11 at 12.23.46](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/4/04eea3b5d605c0731e9aaa10719d404d2c5cf7f8.png)

---

<div class="post-metadata">

**Author:** ![Ludvig](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ludvig/32/129091_2.png) [@Ludvig](https://community.homey.app/u/Ludvig)\
**Post date:** [December 13, 2022, 9:00am UTC](https://community.homey.app/t/app-pro-image-poster-upload-image-tokens-to-your-website/32904/12 "2022-12-13T09:00:16Z")

</div>

> [@John\_Stelten](#):
>
> Only absolute URLs are supported

This is so strange. I would guess its some updates to code libraries either on Athom or connected to my app. I will look in to it and see if I can reproduce.

---

<div class="post-metadata">

**Author:** ![Caseda](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/caseda/32/138695_2.png) [@Caseda](https://community.homey.app/u/Caseda)\
**Post date:** [December 13, 2022, 9:02am UTC](https://community.homey.app/t/app-pro-image-poster-upload-image-tokens-to-your-website/32904/13 "2022-12-13T09:02:26Z")

</div>

If that’s a eufy doorbell, go see [that topic](https://community.homey.app/t/44921/3151) as to why (eufy patching things), and it isn’t related to this app.

---

<div class="post-metadata">

**Author:** ![DuMees](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dumees/32/75943_2.png) [@DuMees](https://community.homey.app/u/DuMees)\
**Post date:** [October 5, 2023, 4:19am UTC](https://community.homey.app/t/app-pro-image-poster-upload-image-tokens-to-your-website/32904/14 "2023-10-05T04:19:10Z")

</div>

Is it possible to add a tag that captures the response (so I can parse the JSON response)?

---

<div class="post-metadata">

**Author:** ![Christian\_Grewenig](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/christian_grewenig/32/49383_2.png) [@Christian\_Grewenig](https://community.homey.app/u/Christian_Grewenig)\
**Post date:** [October 18, 2024, 8:59pm UTC](https://community.homey.app/t/app-pro-image-poster-upload-image-tokens-to-your-website/32904/15 "2024-10-18T20:59:23Z")

</div>

Hello,

I have been trying to use the ImagePoster app this week to send a picture from my camera to a php script on my server. All according to the instructions and scripts provided.

However, I seem to have a problem with the content-length specification in the HTTP header.

If I check out the code of the ImagePoster app and test it myself as a development app, then the post to my server works. It makes a difference if you install the app and run it on the homey. The request is rejected with a 411 error.

I have already tried to set the content-length manually. Something like this:

`headers[“content-length”] = '${stream._readableState.length}';`

After that, the array $FILES in the php upload file has not tmp\_name or size. There is error == 3  
Any idea what to do?

Regards  
Christian
