2017 © Pedro Peláez
 

yii2-extension yii2-webcam

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

image

johnson/yii2-webcam

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

  • Tuesday, July 25, 2017
  • by arojohnson
  • Repository
  • 2 Watchers
  • 4 Stars
  • 190 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 6 Forks
  • 1 Open issues
  • 1 Versions
  • 13 % Grown

The README.md

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., (*1)

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., (*2)

Installation

The preferred way to install this extension is through composer., (*3)

Either run, (*4)

php composer.phar require --prefer-dist johnson/yii2-webcam "*", (*5)

or add, (*6)

"johnson/yii2-webcam": "*", (*7)

to the require section of your composer.json file., (*8)

Usage

Once the extension is installed, simply use it in your code by :, (*9)

<?= \Johnson\JayWebcam::widget(); ?>

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., (*10)

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., (*11)

For Example: PHP Code, (*12)

<?= \Johnson\JayWebcam::widget(['id' => $YourID,'imgID' => $imgID]); ?>

HTML Code, (*13)

<input type="hidden" id="<?= $YourID ?>">

<img src="" id="<? $imgID ?>" class="thumbnail">

After clicking the snapshot the value attribute will be assigned to the given element based on ID., (*14)

Example image output :, (*15)

"data:image/png;base64,ASF9D8ASDF89ASDFHA8S9DFH98ADS....", (*16)

The following link may help to save the file to web server, (*17)

https://gist.github.com/fazlurr/9802071, (*18)

The Versions

25/07 2017

dev-master

9999999-dev

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

  Sources   Download

MIT

The Requires

 

by Arockia Johnson SR

extension yii2