https://github.com/arojohnson/yii2-webcam
Yii2 widget to capture the image from desktop / mobile web cam that can be used to upload to web server.
https://github.com/arojohnson/yii2-webcam
yii2-framework yii2-widgets
Last synced: 3 months ago
JSON representation
Yii2 widget to capture the image from desktop / mobile web cam that can be used to upload to web server.
- Host: GitHub
- URL: https://github.com/arojohnson/yii2-webcam
- Owner: arojohnson
- Created: 2017-07-18T10:00:20.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-09-11T06:28:19.000Z (over 5 years ago)
- Last Synced: 2025-01-31T09:22:57.692Z (4 months ago)
- Topics: yii2-framework, yii2-widgets
- Language: JavaScript
- Homepage:
- Size: 9.77 KB
- Stars: 8
- Watchers: 3
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
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:
-------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
------------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
-----Once the extension is installed, simply use it in your code by :
~~~
= \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.
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
~~~
= \Johnson\JayWebcam::widget(['id' => $YourID,'imgID' => $imgID]); ?>
~~~HTML Code
~~~
![]()
~~~After clicking the snapshot the value attribute will be assigned to the given element based on ID.
Example image output :
"data:image/png;base64,ASF9D8ASDF89ASDFHA8S9DFH98ADS...."
The following link may help to save the file to web server
https://gist.github.com/fazlurr/9802071