Page 1 of 1

How to send a Picture using Arduino and ESP8266

Posted: 29. May 2017, 22:53
by tobbeg
Hi
I have Everything working fine sending notifications with dynamic data,
but I seem not get it right sending a Picture, or sending the weblink of a Picture I want to be displayed in the
pushsafer notifications?

What am I getting wrong here?

I use http.post and it works all fine, but I don't get the Picture in my iPhone?

CODE
====
Message += String(F("&p=data:image/jpeg;base64,"));
Message += rbase64.encode(F("weblink of my Picture.jpeg"));

Weblink is made of http: followed by //iot.mydomain.se/filename with .jpeg in the end
(Hope you get it since I am not allowed rtio send the correct weblink :-)

Above is part of the message sent, but my iPhone only shows a very small 2mm x 2mm rectangle


What am I doing wrong here?

Appreciate all the help !

Best regards
Thorbjörn

Re: How to send a Picture using Arduino and ESP8266

Posted: 30. May 2017, 08:00
by admin
Hello,

you have to load the image and base64 encode them.
You can use this library: https://github.com/adamvr/arduino-base64

The encodes image string you have to pass throught the pushsafer parameter p

Hope this helps

Kevin

Re: How to send a Picture using Arduino and ESP8266

Posted: 31. May 2017, 07:05
by tobbeg
Hi again

so you mean the jpeg Picture file itself needs to be part of message sent to Pushsafer in base64 format?

I thought only the web link reference needed to be included in base64 format
and that Pushsafer APP retrieved the jpeg from the www location submitted.

or am I missing something here?

Thanks for your prompt reply
Thorbjörn

Re: How to send a Picture using Arduino and ESP8266

Posted: 31. May 2017, 07:28
by admin
tobbeg wrote:Hi again

so you mean the jpeg Picture file itself needs to be part of message sent to Pushsafer in base64 format?

I thought only the web link reference needed to be included in base64 format
and that Pushsafer APP retrieved the jpeg from the www location submitted.

or am I missing something here?

Thanks for your prompt reply
Thorbjörn
Correct, you have to load the image, encode the binary with base64, the string you get, you have to pass throught the parameter p to pushsafer. Weblinks are not possible. See the API description here: https://www.pushsafer.com/en/pushapi

Regards
Kevin