3

Generating Thumbor URLs on iOS

 2 years ago
source link: https://developer.squareup.com/blog/generating-thumbor-urls-on-ios/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
June 18th, 2014 | 1 minute read

Generating Thumbor URLs on iOS

Faster image loading, better caching, easy.

Twitter
Facebook
Reddit
LinkedIn

Written by Jim Puls.

A little while back, we talked about dynamic images with Thumbor.

To recap:

*Thumbor is an open-source, on-demand image service which allows for server-side cropping, resizing, and compositing of images. This is particularly useful for applications where the density and resolution of the target screen can vary wildly. Rather than downloading a large image and scaling it to fit the display, the image is requested at the exact desired size and the server does the work on-demand to resize it before delivering.*

To go with our Pollexor library on Android, today we’ve open-sourced ThumborURL to do the same on iOS.

It’s really slick and very easy to use. In five lines of code, you can request a resized version of an image:

NSURL *****baseURL **=** [NSURL URLWithString:@"http://my.thumbor.server"];
NSURL *****imageURL **=** [NSURL URLWithString:@"http://www.google.com/images/srpr/logo3w.png"];
TUOptions *****opts **=** [[TUOptions alloc] init];
opts.targetSize **=** CGSizeMake(100, 100);
NSURL *****u **=** [NSURL TU_secureURLWithOptions:opts imageURL:imageURL baseURL:baseURL securityKey:@"use-a-better-security-key-than-this"];

Try it out! Let us know what you think. Jim Puls - Profile Eternally curious.medium.com

Picture of Square Engineering

By Square Engineering
@SquareEngMedium


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK