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