Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70440

Add custom string on camera preview & save image with string on image

$
0
0

@kalpeshkkalekar wrote:

I have added ionic-native/camera-preview to my ionic3 app, i have got the camera preview working & able to save image but now i want to add custom string on camera preview like lat,lon or timestamp & save image with that string

I tried overlaying string on camera preview with css but it wont save image with string.

this is what i have

import { CameraPreview, CameraPreviewPictureOptions, CameraPreviewOptions, CameraPreviewDimensions } from '@ionic-native/camera-preview';

export class HomePage {

constructor(public navCtrl: NavController,private camera: Camera,private cameraPreview: CameraPreview,private platform:Platform) {

    this.platform.ready().then( () => {

        const cameraPreviewOpts: CameraPreviewOptions = {
            x: 0,
            y: 0,
            width: window.screen.width,
            height: window.screen.height,
            camera: 'rear',
            tapPhoto: true,
            previewDrag: true,
            toBack: true,
            alpha: 1
        };

        this.cameraPreview.startCamera(cameraPreviewOpts).then( (res) => {
            console.log(res)
        },
        (err) => {
            console.log(err)
        });
    })

}
base64Image

takePicturePreview(){
    // picture options
    const pictureOpts: CameraPreviewPictureOptions = {
        width: 1280,
        height: 1280,
        quality: 85
    }

    // take a picture
    this.cameraPreview.takePicture(pictureOpts).then((imageData) => {
        console.log(imageData);
    });
}

takePicture(){
    const options: CameraOptions = {
        quality: 100,
        destinationType: this.camera.DestinationType.FILE_URI,
        encodingType: this.camera.EncodingType.JPEG,
        mediaType: this.camera.MediaType.PICTURE
    }



    this.camera.getPicture(options).then((imageData) => {
        // imageData is either a base64 encoded string or a file URI
        // If it's base64 (DATA_URL):
        this.base64Image = imageData;
    }, (err) => {
        // Handle error
        console.log(err);
    });
}

 }

I want to show lat,lon & timestamp on camera preview & save image with that string on image

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70440

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>