Posted By

parkerkrhoyt on 11/17/11


Tagged

phone image standards web gallery access photo device roll album phonegap gap


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

mmcachran
Priestd09


Accessing the Device Photo Gallery with PhoneGap


 / Published in: JavaScript
 

  1. $( '#roll' ).bind( 'touchstart', function() {
  2. $( this ).attr( 'src', 'assets/roll.down.png' );
  3.  
  4. navigator.camera.getPicture( function( data ) {
  5. $( '#photo' )
  6. .attr( 'src', 'data:image/jpeg;base64,' + data )
  7. .css( 'visibility', 'visible' );
  8.  
  9. $( '#roll' ).attr( 'src', 'assets/roll.up.png' );
  10. }, function( error ) {
  11. console.log( 'Error' );
  12. }, {
  13. destinationType: Camera.DestinationType.DATA_URL,
  14. sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
  15. allowEdit: false,
  16. targetWidth: 260,
  17. targetHeight: 435,
  18. mediaType: Camera.MediaType.PICTURE
  19. } );
  20. } );

Report this snippet  

You need to login to post a comment.