0

I'm using nativescrip-background-http plugin to upload images to a remote server.

The idea is that I use nativescript-imagepicker plugin to select the image, save it to a folder using saveToFile then upload it.

saveToFile works well with smaller files but there's a lug when the file size is big. Is there a way to reduce file size before saving it?

mikie
  • 60
  • 9

2 Answers2

1

I was able to circumnavigate the issue by setting the image height, width and quality using getImage() as shown bellow.

getImage({maxWidth: 200, maxHeight: 200, quality: 100})

This makes all files saved using saveToFile method of a uniform quality thus no lugging while dealing with large or smaller files. A better suggestion would be great though.

mikie
  • 60
  • 9
0

You can check this Compress images on client side before uploading. But you will lose some data while compressing.

In the case of image, it will be the resolution.

kawadhiya21
  • 2,458
  • 21
  • 34