Package nz.ac.canterbury.kraken.examples

Source Code of nz.ac.canterbury.kraken.examples.App

/*
* Example usage of the API
*/
package nz.ac.canterbury.kraken.examples;

import nz.ac.canterbury.kraken.JKraken;
import nz.ac.canterbury.kraken.JKrakenResult;
/**
*
* @author davidm
*/
public class App {
    private static JKraken kraken;
    private static JKraken.Options params;
    private static JKrakenResult jkrakenResult;

    public static void main(String[] args) {
       
        //URL with wait
        kraken = new JKraken("fa8c407e93686be8a69d1c8cec6dbb87", "3da9b85e541b705a0c6be6a5e0dbeea66079e9be");
        kraken.setDebug(true);
        params = new JKraken.Options();
        params.setUrl("http://www.canterbury.ac.nz/brand/home/slides/engineering2.jpg");
        params.setWait(true);
        params.setWebp(false);
        params.setLossy(true);
        jkrakenResult = kraken.url(params);
       
       
        //URL with callback
        kraken = new JKraken("fa8c407e93686be8a69d1c8cec6dbb87", "3da9b85e541b705a0c6be6a5e0dbeea66079e9be");
        kraken.setDebug(true);
        params = new JKraken.Options();
        params.setUrl("http://www.canterbury.ac.nz/brand/home/slides/engineering2.jpg");
        params.setCallbackUrl("http://wcmsuat.canterbury.ac.nz/callback.php");
        params.setWebp(false);
        params.setLossy(true);
        jkrakenResult = kraken.url(params);
       
        //Upload with wait
        kraken = new JKraken("fa8c407e93686be8a69d1c8cec6dbb87", "3da9b85e541b705a0c6be6a5e0dbeea66079e9be");
        kraken.setDebug(true);
        params = new JKraken.Options();
        params.setFile("/home/davidm/Pictures/frogman-happy.jpg");
        params.setWait(true);
        params.setWebp(false);
        params.setLossy(true);
        jkrakenResult = kraken.upload(params);
       
        //upload with Callback
        kraken = new JKraken("fa8c407e93686be8a69d1c8cec6dbb87", "3da9b85e541b705a0c6be6a5e0dbeea66079e9be");
        kraken.setDebug(true);
        params = new JKraken.Options();
        params.setFile("/home/davidm/Pictures/frogman-happy.jpg");
        params.setCallbackUrl("http://wcmsuat.canterbury.ac.nz/callback.php");
        params.setWebp(false);
        params.setLossy(true);
        jkrakenResult = kraken.upload(params);
       
        //get user status
        kraken = new JKraken("fa8c407e93686be8a69d1c8cec6dbb87", "3da9b85e541b705a0c6be6a5e0dbeea66079e9be");
        kraken.setDebug(true);
        jkrakenResult = kraken.status();
       
    }
}
TOP

Related Classes of nz.ac.canterbury.kraken.examples.App

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.