1

I have a webcam (Logitech Webcam Pro 9000) attached to the webserver via USB, and I need to periodically take still photographs (strictly server-side, no video necessary, no Javascript). Until now this was accomplished by an app called WebcamXP, but that is a bit unstable, has many limitations, and is entirely inflexible.

Can I, instead, use PHP - along with some lightweight extension/plugin - to accomplish this chore of capturing the stills?

aag
  • 680
  • 2
  • 12
  • 33
  • 2
    This is the answer http://stackoverflow.com/questions/11380423/using-php-to-interpret-message-from-parallel-port/11380534#11380534 –  Jul 14 '12 at 19:43

3 Answers3

1

To expand on Parahat's information. No there is no way to do it strictly with PHP. But at least in most flavors of linux there should be a way to do it.

Look at the answer here for terminal programs that could do this functionality, install one (for ubuntu that'd be apt-get) that would work for your webcam (most of the programs should work with most webcams, because of similar standards), and then execute the terminal command to grab a still from the camera.

Hope that gets you on the right track.

Community
  • 1
  • 1
Jess
  • 8,628
  • 6
  • 49
  • 67
  • Thank you - this does get me onto the right track. I should have mentioned however that I am on Windows. Are you aware of any CLI software which would have this functionality and run on Windows? – aag Jul 14 '12 at 19:58
1

I found it!!! Use a very small and handy software called "VLC". The CLI string is, in my case,

C:\Program Files (x86)\VideoLAN\VLC>vlc --dshow-vdev="Logitech Webcam Pro 9000"
"dshow://" :dshow-size="320x240" --run-time=1 --scene-ratio=24 
--scene-path=C:\TestSite --scene-format=jpeg --scene-prefix=snap 
--no-audio --video-filter=scene
-V dummy --intf=dummy --dummy-quiet

See also http://forum.videolan.org/viewtopic.php?f=2&t=63313 for more details.

aag
  • 680
  • 2
  • 12
  • 33
1

..and here is, for those who like the "full service", the PHP code in a well-structured way:

<?
$CaptureString='"C:\Program Files (x86)\VideoLan\VLC\vlc.exe"'.
' --dshow-vdev="Logitech Webcam Pro 9000" '.
'"dshow://" '.
':dshow-size="320x240" '.
'--run-time=1 '.
'--scene-ratio=24 '.
'--scene-path=C:\TestSite '.
'--scene-format=jpeg '.
'--scene-prefix=snap '.
'--no-audio '.
'--video-filter=scene '.
'-V dummy '. '--intf=dummy '.
'--dummy-quiet '.
'vlc://quit';
$last = exec($CaptureString, $output, $returnvar);
?>
aag
  • 680
  • 2
  • 12
  • 33