user
user

Reputation: 1001

How to access the gallery in phonegap/android?

I am new to phonegap.

I do not know what is the procedure to access the gallery of the phone using javascript?

I did not find any related article regarding this .So,Please help me!!

EDIT VERSION

Well,While waiting for your answers I was trying with the example in the phonegap docs...

Well, this connects me to the GALLERY.

While Executing that program I found out that,pics that are taken from the app,does not get stored anywhere.

2 queries

query 1) That is i take pictures,...those are there....when i come and open the app for the 2nd time..no Pics(here I open the application twice)

query 2) Suppose, I select 1 photo from the gallery,now i want the other photo too...when i select the second the 1st one vanishes....(here I open the application once)

Where should I store the photos clicked from the app and HOW should I store --i mean the procedure to do it/method to be followed.

suggestions and solutions please!!

Upvotes: 0

Views: 5147

Answers (5)

Mohit
Mohit

Reputation: 311

Hi these are the option you can use with the Camera Capture. i think when you set saveToPhotoAlbum to true it will save your images to photo Album that you can access later. but if you looking for multiple image upload at a time from gallery you can't do that. but you can upload the multiple image from the camera capture.

{ 
  quality : 75,
  destinationType : Camera.DestinationType.DATA_URL,
  sourceType : Camera.PictureSourceType.CAMERA,
  allowEdit : true,
  encodingType: Camera.EncodingType.JPEG,
  targetWidth: 100,
  targetHeight: 100,
  popoverOptions: CameraPopoverOptions,
  saveToPhotoAlbum: false 
};

Upvotes: 0

user2772699
user2772699

Reputation: 11

While Executing that program, I found out that pics that are taken from the app are not get stored anywhere.

To store in the photo gallery the photos taken by the app, use the option saveToPhotoAlbum:

navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 40, allowEdit: true, destinationType: Camera.DestinationType.FILE_URI, **saveToPhotoAlbum: true** });

Upvotes: 1

gaepi
gaepi

Reputation: 404

If you want to pick an image from your photo gallery, check the "Full Example" of phonegap api : camera.getPicture

There is a camera option which allows you to take a photo from gallery (PHOTOLIBRARY)

Camera.PictureSourceType = {
    PHOTOLIBRARY : 0,
    CAMERA : 1,
    SAVEDPHOTOALBUM : 2
};

Upvotes: 1

nsawaya
nsawaya

Reputation: 623

You have to write plugins for specific platforms, and call them, so you'll have to go native for that

Upvotes: 2

Related Questions