Ionic Camera Preview on Ionic 2: can I fit the camera preview to a specific div?

Hi everyone!

Right now I’m creating an Ionic 2 application using ionic-camera-preview (https://ionicframework.com/docs/native/camera-preview/).
The “problem” with this plugin is that you must indicate the position (coordinates x and y) where the preview starts, and its height and width. Is there any way of fitting the cammera preview to an specific div?

Thank you for your time!

Regards

From looking at the Cordova plugin documentation this is not possible:
https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview#startcameraoptions-successcallback-errorcallback
Maybe open an issue there to see if there is a way to bind this to html elements?

Yes, I looked into the documentation and it’s not possible. I will open a Github issue to see if there is a way to do that.

I’ve seen that a possible “fix” could be extract the position of a div (x and y coordinates, height and weight) and set it to the camera. This would work.

Thank you for your help and your time!

1 Like

Post the issues URL here when you posted so it is crossreferenced, could maybe be useful in the future. Thanks.

Done! https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview/issues/284