I need to implement a photo capture on Meteor. Is there any Meteor package to achieve image capturing?
I'm using the mdg:camera package. It's simple and useful.
meteor add mdg:camera
First you can create a link on the html side.
<template name="example">
<a href="#" class="takePhoto">take photo</a>
<img class="photo">
</template>
After clicking, you can change the captured picture.
Template.example.events({
'click .takePhoto': function(e, instance) {
e.preventDefault();
var cameraOptions = {
width: 800,
height: 600
};
MeteorCamera.getPicture(cameraOptions, function (error, data) {
if (error) {
return; // here maybe you can give an error.
}
instance.$('.photo').attr('src', data);
});
}
});
You can also check here for some picture options:
https://github.com/meteor/mobile-packages/blob/master/packages/mdg:camera/README.md#meteorcameragetpictureoptions-callback
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With