PHP Webcam Capture: Save picture taken from Webcam to a file or MySQL

Recommend this page to a friend!
  Info   Demos   Videos   View files (13)   Download .zip   Reputation   Support forum (9)   Blog    
Ratings Unique User Downloads Download Rankings
73%Total: 4,254 This week: 15All time: 693 This week: 17
Version License PHP version Categories
webcam-in-php 1.0.4GNU General Publi...5HTTP, PHP 5, Graphics, Files and Folders
Description Author

This class can save picture taken from Webcam to a file or MySQL.

It can take a request sent from a JavaScript script that takes a snapshot of a image taken with the Webcam and saves the image to a server file.

The class serves the path of the saved image as output of the handler script, so the browser can display it to the user.

The image can also be saved to a MySQL database table record.

Innovation Award
PHP Programming Innovation award nominee
April 2017
Number 5

Prize: One big elePHPant Plush Mascott
Many Web sites need to take pictures of their users. One way to achieve this is to take a snapshot of the user image using his computer or mobile device Webcam.

This class can take pictures captured using a Webcam and uploaded to the server, so it can save the images to server files or a MySQL database table.

Manuel Lemos
Picture of Vivek moyal
  Performance   Level  
Name: Vivek moyal is available for providing paid consulting. Contact Vivek moyal .
Classes: 7 packages by
Country: India India
Age: ???
All time rank: 50927 in India India
Week rank: 14 1 in India India
Innovation award
Innovation award
Nominee: 2x

Winner: 1x


Webcam in PHP Using html5

Use webcam in PHP using HTML5, Jquery and Save the Image to Database

This repository will help you to integrate and save the captured image to the database or local folder.


Here are some code structure to understand the important parts of this class.

$imageFolder="your folder"; - This is your folder where you would like to save the file
showImage() - This function will get the image and return the name including the path

If you want to save the image to database than you can use this function.

changeImagetoBase64() - This function will change the image to base64 
saveImageToDatabase() -  It will help you to save the image to database

  Use Webcam in PHP  
File Role Description
jpeg_camera (5 files)
webcamImage (1 file)
connectionClass.php Class Database connection class file
webcamClass.php Class Webcam class file to get the image and save the image
action.php Example Example script
index.php Example Index file for showing the webcam
LICENSE Lic. License text Doc. Documentation
webcam.sql Data Auxiliary data

  Files  /  jpeg_camera  
File Role Description
   canvas-to-blob.min.js Data Auxiliary data
   jpeg_camera_no_flash.min.js Data Auxiliary data
   jpeg_camera_with_dependencies.min.js Data Auxiliary data
   swfobject.min.js Data Auxiliary data
   test.txt Doc. Documentation

  Files  /  webcamImage  
File Role Description
   webcam-image-folder.txt Data Dummy file to keep this directory

 Version Control Unique User Downloads Download Rankings  
This week:15
All time:693
This week:17
User Ratings User Comments (2)
 All time
3 years ago (Indika Kulasinghe)
without shutter.
3 years ago (KillerDr)

For more information send a message to info at phpclasses dot org.