Comments (9)
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.
Same issue here. NS 6.4 using Vue
from nativescript-imagepicker.
I also have the same problem. Any solution on this?
from nativescript-imagepicker.
i'm also getting same issue
from nativescript-imagepicker.
Same issue here, on {NS} 6.4 with Vue.
from nativescript-imagepicker.
Yes I am seeing the same on iOS with NS 6.2 with Angular
from nativescript-imagepicker.
@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.
It works! Thank you very much!
from nativescript-imagepicker.
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)
- Error on multiple number of picking Calling js method onStart failed
- I can only select files from the Screenshots and Camera directories
- Imagepicker do not take 100% height HOT 1
- [android]error not easy to "filter" HOT 1
- Can ImagePicker be used to select videos from camera roll? If not, any suggestions? HOT 2
- Feature request: Better errors
- [IOS]multiple dependencies with different sources for `QBImagePickerController` issue when install with @nstudio/nativescript-camera-plus HOT 1
- How can i select directly from Gallery rather than downloads
- Plugin translation
- [android] No path for returned image(s) HOT 1
- JS: TypeError: Cannot read property 'startActivityForResult' of undefined
- Class constructor Observable cannot be invoked without 'new' Nativescript 7.0.0 HOT 3
- IOS on dismiss picker canceled error is not fired
- Plug-in does not work in NativeScript 8 HOT 2
- Android: How to get file extension of images selected using @nativescript/imagepicker HOT 1
- What is the migration guide from NS-6 to NS-8 for nativescript-imagepicker?
- "fromAsset() is deprecated. Use ImageSource.fromAsset()" while using ImageSource.fromAsset()
- [Image Picker] Images in iPhone Library not visible
- Can't set permisssions on Android 12 (can't authorize) [nativescript-imagepicker] HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nativescript-imagepicker.