Compress and Upload Images using NativeScript

Over the past couple of weeks, I have been working on a new iOS and Android app using NativeScript. One of the requirements is to compress and upload images. I figured this would be pretty straightforward but couldn’t find any examples of how to accomplish image compression. After some trial and error, I came up with a simple solution that has worked well. Hopefully, this example will save you some time!

The key piece of code is imageSource.saveToFile which takes a third argument that is compressionValue. This allows you to compress the image to a value from 1-100. Check out the playground example below and feel free to ask any questions in the comments below.

var saved = imageSource.saveToFile(path, "jpg", compressionValue);

Demo

Playground Example

GitHub Repo

 

Fix Cabinet Doors that Overlap

Recently we had our kitchen cabinets painted and new hinges installed. Everything looked great but the cabinet doors overlapped slightly on the edge due to the new hinges and additional paint. We knew this would cause a lot of frustration and we had to find a way to fix it.

Most suggestions online were to sand or cut the edge of the cabinet door. I felt like this may work but could ruin the cabinet doors. Other solutions were for concealed hinges that had the ability to adjust the position of the doors. After some searching, I finally came across a video that had a simple solution to the problem. The magic tool was a dish towel wedged in between the doors to slightly bend the hinges into the correct position. It took about 5 minutes to fix all my cabinet doors. I love finding a simple solution to a problem!

How to Save at Starbucks

If you are a coffee drinker, you know how much habit can add up. Want to save a $1 on every cup? You need to get the Cash app by Square.

Cash is a free payment app similar to Venmo or Paypal with a bonus. Once you get their debit card, you are able to enable a Boost to save at retailers, along with coffee shops such as Starbucks. You can only select one Boost at a time, and Boosts can be swapped every 24 hours.

My favorite Boost is the $1 off at any coffee shop. This boost can be used every hour and requires a minimum purchase of $1.50. Such a great deal and will save you a lot over time. If you are like me and do not want to carry around another card, just add the Cash card to Apple Pay.

Sign up for Cash App and start saving!