Skip to content

About

Snapshot form_ui using saycheese.js

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

Camera for ActiveScaffold

Currently, this plugin is compatible with ActiveScaffold >= 3.4 gem.

Overview

This plugin adds a camera viewer to take a snapshot from camera on ActiveScaffold forms. It uses SayCheese.js

Browser compatibility

The plugin uses the modern navigator.mediaDevices API when available, including enumerateDevices() and deviceId constraints. The legacy callback-based API, MediaStreamTrack.getSources, and sourceId constraints remain available as a fallback for older browsers.

Camera access requires a secure context (HTTPS or localhost) and the user's permission.

Installation

You'll need at least ActiveScaffold 3.4 to use this

gem install active_scaffold_camera

Usage

Step 1

Set column to use :snapshot form_ui

Step 2

Setup snapshot using options method on column

# app/controllers/visitors_controller.rb

class VisitorsController < ApplicationController
  active_scaffold :visitor do |config|
    config.columns[:id_card].form_ui = :snapshot
    config.columns[:id_card].options = {:source => -1}
  end
end

Available options: video_not_supported, audio_not_supported, media_forbidden, source

Source can be set to use a specific source instead of displaying source selector. It must be the source index, and it can be negative index to start from end. If no device on that index, first device will be used.

If video_not_supported, audio_not_supported or media_forbidden are symbols they will be translated (using as_ method, so it must be on active_scaffold namespace). They have a default translation.

Save image

Snapshot form_ui sends a data url, encoded on base64, of the image, so it should be saved on column of blob type.

Support

If you have issues installing the plugin, search / post to the Active Scaffold forum or Create an issue

Contributing

Fork, hack, push, and request a pull:

http://github.com/activescaffold/active_scaffold_camera/

License

Released under the MIT license (included).

About

Snapshot form_ui using saycheese.js

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages