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


#1

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


#2

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?


#3

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!


#4

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


#5

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