Image from camera, upload to PHP

Hi guys,

I feel like I have this one almost cracked but there is something eluding me, I am hoping someone here might know whats up.

Basically I take pictures with the camera on a timed interval, like a timelapse webcam kind of thing.

After I take the picture successfully, I try to upload it to my webserver with some code like this:

POSTContent postData = POSTContent.CreateBinaryBasedContent(picture.PictureData);

HttpRequest reqData = HttpHelper.CreateHttpPostRequest("http://www.therossman.org/cam.php", postData, "image/bmp");
reqData.ResponseReceived += new HttpRequest.ResponseHandler(reqData_ResponseReceived);
reqData.SendRequest();

Everything works ok except that on my webserver my PHP script can’t get the posted image data? It is called successfully and my logging in the PHP script works, but, I can’t figure out how to access the data that .NET posted :frowning:

I added some logging to the php script to trace out $_POST/$_GET but I don’t get anything…
I found an example but it only had .NET server side code so that didn’t help me.

Anyone know how to accept a post from .NET in PHP?

(yes I do realize this is probably not the best forum for this but you guys are just so damn helpful :slight_smile: )

Ugh, solved this shortly after posting…

If anyone is wondering it’s just like this (the PHP part anyway)

http://blog.joa-ebert.com/2006/05/01/save-bytearray-to-file-with-php/

Perhaps that will help another wayward traveller…

Cheers!

Will you be making us a time-laps video?

Haha no, but, even better than that I hope!

I’m building a webcam type app but with a servo to control the camera. The servo will be remotely controlled via a webservice (which the spider will monitor), so I can adjust the camera remotely when I am away from home!

Have a feeling I will be buying another Spider once this project is complete :slight_smile:

Just a further question on this - by default the camera takes still images and returns a picture that is a BMP.

I note that there is an enum called GT.Picture.PictureEncoding.JPEG…and couldn’t help but wonder, is there a way we can get the camera to return JPGs?

Dealing with BMP’s is apparently harder than you might expect with PHP, the BMP format is not supported by default with the PHP GD libraries :frowning:

Alternatively, does anyone know how to use .netmf to convert the BMP to JPEG before I upload it? I found some .net tutorials that explain it but I don’t think the classes are available in .netmf…

Cheers!

Here is a working example of a camera that takes a picture then posts it and the server returns the URL

(I know it’s a bit messy)

@ peony3000 -

I would put it on Codeshare:

http://www.tinyclr.com/codeshare/entry/create