Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Add-on] Photo field to capture image through webcam #4

Open
srigurubyo opened this issue Jul 1, 2020 · 4 comments
Open

[Add-on] Photo field to capture image through webcam #4

srigurubyo opened this issue Jul 1, 2020 · 4 comments
Assignees
Labels

Comments

@srigurubyo
Copy link

Feature Request

We would like to capture photo through webcam to be uploaded to DB

What's the feature you think Backpack should have?

Additional field to take photo using webcam similar to filed image option.

Have you already implemented a prototype solution, for your own project?

No

Do you see this as a core feature or an add-on?

Good to have

@tabacitu
Copy link
Member

tabacitu commented Jul 1, 2020

Hmmm not a bad idea @srigurubyo . It should be pretty easy to create a custom field type that uses the capture attribute.

Or better yet - I'm wondering, wouldn't it work with the existing upload field type, if we set the capture attribute to user on the file input?
@srigurubyo - mind trying the approach below and let us know if the solution works well? It's possible that we have this solution built-in, but I've never thought about it:

// using the fluent syntax
CRUD::field('profile_image')->type('upload')->attributes(['capture' => 'user']);

// or using the array syntax
$this->crud->addField([
    'name'      => 'profile_image',
    'label'     => 'Profile Image',
    'type'      => 'upload',
    'upload'    => true,
    'attributes' => ['capture' => 'user'],
    'disk'      => 'uploads',
]);

Cheers!

@srigurubyo
Copy link
Author

srigurubyo commented Jul 1, 2020

Thanks for your response @tabacitu. I tried your above code but getting only the 'Browse' button based file upload control and webcam is not triggered.

image

Since I am not very familiar with the php coding, if you can provide some inputs I am willing to tweak the existing upload to build a new field type.

Thanks in advance for you help here!

@tabacitu
Copy link
Member

tabacitu commented Jul 1, 2020

Well then I imagine it only works on mobile devices, not on desktop.

Personally I don't know of a way to easily do this on desktop - last time I needed this, quite a few years ago, it was done with Flash, but I imagine there are more modern ways to do it nowadays. No idea what ways though.

I think it'd be a cool feature to have, so I'm going to move this to our add-ons repo, so the talk can evolve and maybe result in an add-on for Backpack. I don't see it as an important feature, since Backpack has been around for 5+ years and it's the first I hear this feature request, but I agree it'd be cool to have.

Sorry I can't be of more help @srigurubyo . Let us know if your research results in something that'll be useful to other Backpack developers.

Cheers!

@tabacitu tabacitu changed the title [Feature Request] Photo capture through webcam [Add-on] Photo field to capture image through webcam Jul 1, 2020
@tabacitu tabacitu transferred this issue from Laravel-Backpack/CRUD Jul 1, 2020
@srigurubyo
Copy link
Author

Your workaround works for MOBILE phones but not for laptops. I am trying to come up with a custom field namely 'capture' to accomplish this. I shall keep you posted, if I succeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants