Is it technically possible to access (view the current webcam) using PHP? For example I have a website that has about 23.431 visitors per week, and people are uploading their images with description onto a directory, and it’s being inserted into a MySQL-DB-Table. I’d also like to implement more features, - and the one is viewing your own webcam, taking a shot, and upload the file onto a directory, also onto my MySQL-DB. If it doesn’t work with PHP, I know it does with Perl, but since my Webspace provider does not support Perl, (cgi), I have to live with PHP.
i wouldn’t think so because that would be controlling hardware. If it was possible, then I would believe it could be done with a language other than PHP even though php is a powerful language.
But, I am interested in learning if it is possible.
I’m pretty sure they’re using flash for that. team1504 is right, php can’t access the client’s hardware (and thank heavens for that, think about the security implications!) and thus can’t use/control the client’s webcam. If the client gives permission flash can though
I know the webmaster of this site, and I also know that we’ve had personal problems in the past, since he decided to move on with his web “projects”, and stealing several of mine images after not working with him. He’s not the type of guy who actually knows about Flash, he mainly does mostly PHP, and only some HTML / CSS.
PHP code runs server side.
The Web Cam is client side.
This means that you need something client side, to send the data to the server for processing.
You can use flash for this, and chances are you will need some kind of flash server (red5, macromedia/adobe media server or whatever it’s called now)
If you’re only capturing a still image you won’t need anything on the server other than php
You can capture to a bitmap within flash, then encode to a jpeg using the jpeg encoder from this library. This data can be sent to a php script which will save an image.
Thanks for the tip, EastCoast. If you’re willing, may you describe on what you actually need for running the encoder, (the JPGEncoder.as) file, which is located here?
Probably a bit too long to go over all the necessary steps, but you’d put a video oject in a movieclip, attach your webcam to it, and capture the movieclip to a bitmapData.
Then (having included the jpegencoder script) encode it to a byteArray
var myEncoder:JPGEncoder = new JPGEncoder(myQuality_integer);
myByteArray = myEncoder.encode(myBitmapData);
Then you’d send the byteArray to the server via a normal URLRequest with the byteArray as POST data, and save that data as a file.