zantknight / yii2-cam-capture
This extension is HTML5 Media Capture, integrating with yii2-gallery4
Installs: 252
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 3
Open Issues: 1
Type:yii2-extension
Requires
- kartik-v/yii2-widget-fileinput: @dev
- yiisoft/yii2: ~2.0.0
- yiisoft/yii2-bootstrap4: ~2.0.6
- zantknight/yii2-gallery4: *
This package is auto-updated.
Last update: 2025-05-11 18:35:40 UTC
README
This extension is HTML5 Media Capture, integrating with yii2-gallery4
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist zantknight/yii2-cam-capture "*"
or add
"zantknight/yii2-cam-capture": "*"
to the require section of your composer.json
file.
Usage
Note: Working on with yii2-bootstrap4 only, to shift onto bootstrap4, follow this instruction
- If you have not migrate gallery4 yet, simply execute migration by calling this command
php yii migrate --migrationPath=@vendor/zantknight/yii2-gallery4/migrations
- Update config/web.php
return [ ... 'modules' => [ 'gallery4' => [ 'class' => 'zantknight\yii\gallery\Module', ], ] ]
- Put this chunk in params.php
return [ ... 'bsVersion' => '4.x', ... ];
- Add this behavior to your model
... use zantknight\yii\capture\CamCaptureBehavior; class YourModel extends \yii\db\ActiveRecord { ... public function behaviors() { return [ ... [ 'class' => CamCaptureBehavior::className(), 'model' => $this, 'fieldName' => 'name' ] ... ]; } }
- fieldName = which field you want to add as picture filename
- Put this widget into your view
<?= \zantknight\yii\capture\CamCaptureWidget::widget([ 'ownerModel' => $model ]); ?>
- Make a folder "media" under @web
- Viola
Screenshots