Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

step 14, Cannot get picture file blob from camera in iPhone #176

Open
sitexa opened this issue Dec 24, 2017 · 1 comment
Open

step 14, Cannot get picture file blob from camera in iPhone #176

sitexa opened this issue Dec 24, 2017 · 1 comment

Comments

@sitexa
Copy link

sitexa commented Dec 24, 2017

1,From messages-attachments.ts:
sendPicture(camera:boolean) -> this.pictureService.getPicture(camera,false) ;
2, From picture.ts: getPicture(camera:boolean,crop:boolean):Promise<File>

return this.camera.getPicture(<CameraOptions>{
      destinationType: 1,//image file URI
      quality: 50,
      correctOrientation: true,
      saveToPhotoAlbum: true,
      sourceType: camera ? 1 : 0, //from camera
      mediaType: 2 //picture and video
    })
      .then((fileURI) => {
        return crop ? this.crop.crop(fileURI, {quality: 50}) : fileURI;
      })
      .then((croppedFileURI) => {
        return this.convertURLtoBlob(croppedFileURI); //line-A
      });

No Promise<File> returned to caller. I doubt if the line this.convertURLtoBlob(...) don't work correct, but don't knnow why and have no way to debug.
Can anybody help?

@IvanLjubicic
Copy link

IvanLjubicic commented Jan 2, 2018

Actually, I have similar problem with picture upload on iOs.
I had an error like this:
Not allowed to load local resource : file:///var/mobile
I used this solution

https://stackoverflow.com/questions/44910984/ionic-3-file-uri-not-allowed-to-load-local-resource-ios

and app got through this part of code, but eventually it raises exception in this method

`upload(blob: File): Promise {
return new Promise((resolve, reject) => {
const metadata: any = _.pick(blob, 'name', 'type', 'size');

  if (!metadata.name) {
    metadata.name = DEFAULT_PICTURE_URL;
  }

  const upload = new UploadFS.Uploader({
    data: blob,
    file: metadata,
    store: PicturesStore,
    onComplete: resolve,
    onError: reject
  });

  upload.start();
});

}`

It seems like on iOs code in this method cannot read name and size of picture, so it crashes later on while uploading.

Any suggestions would be nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants