API Documents
ImageTS API Access point URL :
http://imagets.com/api/{Licence ID}
Method for processing image
Use POST method on your request when you want to process an image.
http://imagets.com/api/{Licence ID}
var my_images = ['http://imagets.com/images/sample.jpg', 'http://imagets.com/images/sample2.jpg', ...];
var options = { flip : true, options ... };
POST : { images : my_images , apply : options }
Parameters for Applying
Parameter |
Values |
flip |
boolean true, false |
width |
int NUMBER [1-2048] |
height |
int NUMBER [1-2048] |
quality |
int NUMBER [0-100] |
watermark |
string "http://mysite.com/logo.png" |
w_percent (Watermark percent) |
int NUMBER [0-100] |
opacity (Watermark opacity) |
int NUMBER [0-100] |
position |
string upperLeft, lowerLeft, upperRight, lowerRight, center |
border |
array array('color'=> '#COLOR', 'weight'=> 'NUMBER') |
crop |
array array(X, Y) |
layer |
string You can use these values : white, canvas, bricks, dots, insta-blue, red, clouds, green, vignette, album, oldphoto |
Examples Codes and samples (jQuery)
This sample use Jquery library. This sample flip image and add border 2px and #ccc color.
var images = ['http://imagets.com/images/sample.jpg'];
var apply = { flip: true, border: {color:'#ccc', weight:'2'} };
$.ajax({
type: "POST",
url: 'http://imagets.com/api/{Licence ID}',
data: JSON.stringify({images: images, apply: apply}),
success: function(data){
console.log("Done!");
},
dataType: "json"
});
This code changes quality.
var images = ['http://imagets.com/images/sample.jpg', 'http://imagets.com/images/sample2.jpg'];
var apply = { quality : 50 };
$.ajax({
type: "POST",
url: 'http://imagets.com/api/{Licence ID}',
data: JSON.stringify({images: images, apply: apply}),
success: function(data){
console.log("Done!");
},
dataType: "json"
});
Example Codes (PHP)
Example for Jquery.
$images = ['http://imagets.com/images/sample.jpg'];
$apply = array( 'flip'=> true, 'border'=> array('color' => '#ccc', 'weight' =>'2') );
$array = json_encode(array('images' => $images, 'apply' => $apply));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://imagets.com/api/{Licence ID}');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $array);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);
Response
Get image download link.
[{"src":"http:\/\/imagets.com\/get\/{Licence ID}\/sample.jpg", "type":"image\/jpeg"}]