Coder Social home page Coder Social logo

Comments (9)

pana-cc avatar pana-cc commented on June 11, 2024 3

Camera roll images are affected by cloud services. On phones with cloud enabled local copies may be evicted leaving just a thumbnail behind. The actual data can be copied in the cloud and downloaded later if requested. This applies for both Android and iOS.

The image-picker selection returns ImageAsset objects. These objects are abstraction over PHAsset for iOS and similar URI based mechanisms for Android.

The core-modules have ImageSource class that handles image data that is available on the phone and can be rendered in UI, saved to file etc. See https://docs.nativescript.org/api-reference/modules/_image_source_#fromasset how you can obtain ImageSource for each ImageAsset. When you convert ImageAsset to ImageSource the actual image data may be downloaded from the cloud behind the scenes.

After obtaining ImageSource save the actual image to a temp folder using ImageSource saveToFile: https://docs.nativescript.org/api-reference/classes/_image_source_.imagesource#savetofile see the known folders "temp" field: https://docs.nativescript.org/api-reference/modules/_file_system_.knownfolders#temp

After saving the images to a temporary location you can use them in the background-http. It is important to copy them in temp file as the original images local files can be deleted to free up space before the background upload completes to free up space.

from nativescript-imagepicker.

darrenkhouston avatar darrenkhouston commented on June 11, 2024 1

Same issue here. NS 6.4 using Vue

from nativescript-imagepicker.

annadante avatar annadante commented on June 11, 2024

I also have the same problem. Any solution on this?

from nativescript-imagepicker.

max-pro avatar max-pro commented on June 11, 2024

i'm also getting same issue

from nativescript-imagepicker.

Rho-bur avatar Rho-bur commented on June 11, 2024

Same issue here, on {NS} 6.4 with Vue.

from nativescript-imagepicker.

chakotha avatar chakotha commented on June 11, 2024

Yes I am seeing the same on iOS with NS 6.2 with Angular

from nativescript-imagepicker.

Rho-bur avatar Rho-bur commented on June 11, 2024

@pana-cc I will try to do as advised, thank you! One more question though, on Android I am sending the image file to the API server, upon receiving the content-length header shows the image's size correctly but the file saved has 0 length.
I read somewhere that this may happen on the code running in emulator (and not on a real device) is that true?

from nativescript-imagepicker.

syahnur197 avatar syahnur197 commented on June 11, 2024

It works! Thank you very much!

from nativescript-imagepicker.

andrewm-mitchells avatar andrewm-mitchells commented on June 11, 2024

Camera roll images are affected by cloud services. On phones with cloud enabled local copies may be evicted leaving just a thumbnail behind. The actual data can be copied in the cloud and downloaded later if requested. This applies for both Android and iOS.

The image-picker selection returns ImageAsset objects. These objects are abstraction over PHAsset for iOS and similar URI based mechanisms for Android.

The core-modules have ImageSource class that handles image data that is available on the phone and can be rendered in UI, saved to file etc. See https://docs.nativescript.org/api-reference/modules/_image_source_#fromasset how you can obtain ImageSource for each ImageAsset. When you convert ImageAsset to ImageSource the actual image data may be downloaded from the cloud behind the scenes.

After obtaining ImageSource save the actual image to a temp folder using ImageSource saveToFile: https://docs.nativescript.org/api-reference/classes/_image_source_.imagesource#savetofile see the known folders "temp" field: https://docs.nativescript.org/api-reference/modules/_file_system_.knownfolders#temp

After saving the images to a temporary location you can use them in the background-http. It is important to copy them in temp file as the original images local files can be deleted to free up space before the background upload completes to free up space.

Hi @pana-cc, thank you for describing in details how it works for images stored in the cloud. Is there a similar technique for the videos? I've been working on video uploads for four weeks now and we're starting to think NS was not the best choice because we've had issues with AWS plugins first (most of them are deprecated or not well documented) and we're having a problem uploading videos from the device. I tried using ImageSource.fromAsset but it works only for images (png, jpeg, jpg).
Any help would be highly appreciated at this point.

Thank you,
Andrew

from nativescript-imagepicker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.