Skip to Main Content

ADF Mobile : Issue in image selected from Photo Library

1052267May 21 2014 — edited May 21 2014

Hi All,

My requirement is to show an image. In the beginning when there is no image selected by user it shows a default missingImage.

Now the user can take a new pic from camera or he can upload from photo library.

In my case from camera is working and the image is getting shown in my page.

But not when user is selecting from photo library.

Code:

--------

    private String photo = "/images/missingImage.png";

    public void getPhotoFromCamera(ActionEvent actionEvent) {

        String photo1 = DeviceManagerFactory.getDeviceManager().getPicture(40,

        DeviceManager.CAMERA_DESTINATIONTYPE_DATA_URL,

        DeviceManager.CAMERA_SOURCETYPE_CAMERA, false,

        DeviceManager.CAMERA_ENCODINGTYPE_JPEG, 600, 600);

        photo1 = "data:image/gif;base64," + photo1;

        setPhoto(photo1);

        }

    public void getPhotoFromLibrary(ActionEvent actionEvent) {

        String photo1 = DeviceManagerFactory.getDeviceManager().getPicture(40,

        DeviceManager.CAMERA_DESTINATIONTYPE_DATA_URL,

        DeviceManager.CAMERA_SOURCETYPE_PHOTOLIBRARY, false,

        DeviceManager.CAMERA_ENCODINGTYPE_JPEG, 600, 600);

        photo1 = "data:image/gif;base64," + photo1;

        setPhoto(photo1);

    }

    public void setPhoto(String photo) {

        String oldPhoto = this.photo;

        this.photo = photo;

        propertyChangeSupport.firePropertyChange("photo", oldPhoto, photo);

    }

    public String getPhoto() {

        return photo;

    }

I am using the variable "photo" as the source of image component in amx page.

Kindly suggest if i am missing anything here.

Regards,

Deepak

Comments
Post Details
Added on May 21 2014
1 comment
69 views