GithubHelp home page GithubHelp logo

vishub / yii2-webcam Goto Github PK

View Code? Open in Web Editor NEW

This project forked from arojohnson/yii2-webcam

0.0 1.0 0.0 10 KB

Yii2 widget to capture the image from desktop / mobile web cam that can be used to upload to web server.

PHP 39.46% JavaScript 60.54%

yii2-webcam's Introduction

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.

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

<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.

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

yii2-webcam's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.