ImageShack SDK is a lightweight library for Android. It lets you easily upload and manage your photos using ImageShack API. The SDK wraps all calls so that the devloper does not have to worry about sending HTTP requests and parsing JSON responses. Instead you will be working with ImageShack models which are just Java objects.
JavaDoc can be found in ImageShackSDK/doc/index.html
- Register/login to your ImageShack Account.
- Upload/edit/delete images.
- Like/unlike/comment/fetch images data.
- Create/edit/delete albums.
- Manage account settings.
- View activities (likes, comments, etc).
- Retrieve other users' images/albums.
- Download or clone the reposotory to your computer.
- Start Eclipse.
- Go to File -> Import -> Android -> Existing Android Code into Workspace.
- Hit Browse and navigate to the location from step 1.
- Make sure that Demo and ImageShackSDK are checked and hit Finish.
There is one more thing needed to run the Demo app.
- Go to https://imageshack.com/contact/api to request your developer key. The key is required to instantiate ImageShackClient object.
- Open Demo/src/com/imageshack/demo/LoginActivity.java file and enter your key on line 42
private final String API_KEY = null;Now you are ready to launch Demo app.
This is how you can upload an image to ImageShack.
// Get an instance of ImageShackClient with your API key and authToken. The
// authToken is retrieved with login() method. See Demo's LoginActivity.java
// for more info.
ImageShackClient isClient = new ImageShackClient(API_KEY, authToken);
// Init parameters
String[] tags = { "random", "tag", "random tag" };
String title = "work station";
String album = "Test album";
Boolean commentsDisabled = null, isPublic = null;
String path = "/PATH/TO/FILE"; // See MainActivity for more info
// API call
isClient.uploadImage(path, tags, album, title, commentsDisabled,
isPublic, new ResponseListener() {
@Override
public void onResponse(ImageShackModel model) {
UploadModel upload = (UploadModel) model;
// Visualize results...
}
});This is how you can retrieve a list of images for authenticated user.
// Get an instance of ImageShackClient with your API key and authToken. The
// authToken is retrieved with login() method. See Demo's LoginActivity.java
// for more info.
ImageShackClient isClient = new ImageShackClient(API_KEY, authToken);
// Call getImages API with limit = 3 and no offset. The response listener
// listens for async HTTP response. It needs to be passed for every API call.
isClient.getImages(Integer.valueOf(3), null, new ResponseListener() {
@Override
public void onResponse(ImageShackModel model) {
ImagesModel images = (ImagesModel) model;
// Visualize images...
}
});We have built a dynamic image resizer so you can be as creative as you want when it comes to UI. The ImageModel has a method imagizer() with various parameter sets. For example:
// image is of type ImageModel
// public String imagizer(int width, int height, boolean autoCrop)
String url = image.imagizer(200, 200, true);The above code will generate a URL that returns an image with 200x200 resolution. The autoCrop parameter tells the imagizer that you want an image of exact width and height. If autoCrop == false image will fit into the box defined by width and height while preserving the original dimensions.
You can also apply one of 20 unique filters to your images or convert to grayscale using imagizer.
// public String imagizer(int width, int height, boolean autoCrop, int quality, int filter)
String url = image.imagizer(200, 200, true, 90, 21);You can use something like Android-Universal-Image-Loader to visualize your images.










