PHPackages                             johnson/yii2-webcam - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. johnson/yii2-webcam

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

johnson/yii2-webcam
===================

Capture and upload the image through system / Mobile web cam basic html5 native features.

v0.0.1(8y ago)82.1k7[1 PRs](https://github.com/arojohnson/yii2-webcam/pulls)MITJavaScript

Since Jul 25Pushed 6y ago2 watchersCompare

[ Source](https://github.com/arojohnson/yii2-webcam)[ Packagist](https://packagist.org/packages/johnson/yii2-webcam)[ RSS](/packages/johnson-yii2-webcam/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Yii 2 - Web cam input
=====================

[](#yii-2---web-cam-input)

Capture and upload the image through system / Mobile web cam basic html5 native features. The current release only captures the image from webcam and shows the image in a div. If the desktop does not has webcam obviously can't use this extension any more.. LOL.

Note:
-----

[](#note)

In the localhost chrome browser may not work due to https restrictions. When it goes to production the web app must be in https to work at all platforms. You may test the functionality at FireFox browser.

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

php composer.phar require --prefer-dist johnson/yii2-webcam "\*"

or add

"johnson/yii2-webcam": "\*"

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

Once the extension is installed, simply use it in your code by :

```

```

If you pass the ID of the input element then the base64 encoded image data will be stored in the "value" attribute of the element after taking the snapshot.

If you want to show the thumbnail to the users then you can give the "imgID" property i.e the ![]() tag id attribute value. Then the widget will assign the base64 encoded image into the element.

For Example: PHP Code

```

```

HTML Code

```
