Web camera application

Ok here’s the deal. I’m building a member system for a kiosk. So im building a picture capturing app. But this is the issue. What are the functions for controlling a web cam. I know theres a way. I’ve gotten as far as getting the embedded video into place. Just not sure where to go from here. I was thinking of just building my own function and doing it that way. But there’s gotta be another way. The other half is saving it as a jpeg then storing into a mysql db. do i just capture, print to file, rename the file, store it in a folder, then point the db to the folder?

I’ve got it kinda figured out just some other input would be rad!

Nate