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

 

Alternatives to Bitly

Since Goo.gl shut down back in March 2019, there have not been many other options for shortening URLs. Bitly and Rebrandly are the top companies in the link shortening space but I believe they are too expensive and more complicated than what most people need.

Over the past couple of months, I have been working on a new shortener service T.LY. T.LY offers generous plans with the ability to track stats, protect links with a password and expire links from a number of clicks and/or dates. The API is simple to use and would be a great addition to any application needing to shorten long URLs. There is also an extension for Chrome Firefox, which makes shortening links a breeze.

As I have been working on the service, I have been posting updates to IndieHackers. If you have any questions, please leave a comment below.

Handle Long URL Redirects NGINX

Over the past couple of weeks, I have been working on a URL Shortener Service. When testing the ability to shorten really long urls (over 3500+ characters) I ran into an issue I had never seen before. When trying to redirect to the long url, NGINX would return a 502 error (upstream sent too big header while reading response header from upstream). After some research, I discovered the long url is sent in the header of the response. To fix this issue, I had to change the fastcgi_buffers and fastcgi_buffer_size setting in the location section of NGNIX. Read More

Introducing T.ly

Over the past several months, I have been working on a Link Shortener Extension for Chome and Firefox which has grown to over 50,000 users! The feedback has been great and many users love how simple it is to shorten long links. The extension allows users to select their default shortener service such as T.ly, TinyUrl, Bit.ly, is.gd, To.ly, Cutt.ly, Brevis, Rebrandly, and Lnnkin. In one click, they can shorten a URL which then automatically copies to their clipboard in less than a second.

Since the creation of the extension, the goal has been to give users an alternative to goo.gl which shut down in March 2019. This has worked well but shortener services come and go. So to make the extension more stable, I needed to create my own URL shortener. Read More