/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$( '#camera' ).bind( 'touchstart', function() { $( this ).attr( 'src', 'assets/camera.down.png' ); navigator.camera.getPicture( function( data ) { $( '#photo' ) .attr( 'src', 'data:image/jpeg;base64,' + data ) .css( 'visibility', 'visible' ); $( '#camera' ).attr( 'src', 'assets/camera.up.png' ); }, function( error ) { console.log( 'Error' ); }, { destinationType: Camera.DestinationType.DATA_URL, sourceType: Camera.PictureSourceType.CAMERA, allowEdit: false, targetWidth: 260, targetHeight: 435 } ); } );