 | Sumo Paint APIAdd Sumo Paint to your own website or application |
We are more than happy to provide an API for your own services or applications. You can use it to open and edit any image in Sumo Paint and save it back to your service or application. Here you can find all the info you need for the integration.
NEW! We have launched free Sumo Partner tools for easier integration.
Opening images with GET parameter
Open any image from any website with url-parameter:
http://www.sumopaint.com/app/?url=http://www.snap.fi/image.jpg
Code example:
<a href="http://www.sumopaint.com/app/?url=url_to_open">Open</a>
|
You can open images to new window by adding a simple javascript function:
Open the same image in new window
Code example:
<a href="javascript:window.open('http://www.sumopaint.com/app/?url=url_to_open','sumopaint','resizable=1')">Open</a>
|
You can also change the image title by passing optional parameters: (Click the image to open)
Code example:
<a href="javascript:window.open('http://www.sumopaint.com/app/?url=url_to_open&title=image_title','sumopaint','resizable=1')"><img src="http://www.snap.fi/image.jpg"></a>
|
If you want to save the image back to your system, you need to provide at least service and target paramaters. You can also pass any optional data with opt parameter. Read more from below (Saving images back to your service).
Opening images with POST parameter
You can also use POST method for opening images. You can use the same parameters (url,title,service,target,opt) with both GET and POST methods.
Here is a simple HTML form for sending POST data:
Code example:
<form method="POST" action="http://www.sumopaint.com/app/?"><input type="text" name="url" value="url_to_open"><input type="submit"/></form>
|
Saving images back to your service
If you want to get the modified image back to your service, you need to specify at least url, service and target parameters when you open the image.
You will receive url, title, service, data and opt parameters with POST method to specified target url. Data parameter will include the image data in encoded format (base 64). You need to decode the data before saving (API example on the right).
Please read the terms and privacy policy for more info about the service.
|
|
|
|
|
|
Opening image (GET & POST)
| url | image url (for ex. "http://www.snap.fi/image.jpg") |
| title | image title (for ex. "My Family") |
| service | your service name (for ex. "Facebook") |
| target | target url for data (for ex. http://www.yoursite.com/saveimage.php) |
| opt | your optional data (for ex. image id, user id, redirect url etc.) |
Saving image back to your service (POST)
| url | image url (for ex. "http://www.snap.fi/image.jpg") |
| title | image title (for ex. "My Family") |
| service | your service name (for ex. "Facebook") |
| data | bitmap data (read Saving image chapter below for more info) |
| opt | your optional data (for ex. image id, user id, redirect url etc.) |
| |
|
|
|
|
|
|
|
|
|
Here you can find a simple example how to use our API for your own service:
Download commented source files (zipped)
<html>
<head><title>Sumo Paint API demo</title></head>
<body>
<form action="http://www.sumopaint.com/app/?">
<input type="hidden" name="url" value="http://www.sumopaint.com/images/misc/api.jpg" />
<input type="hidden" name="title" value="Future Buildings" />
<input type="hidden" name="service" value="Sumo Paint API Page" />
<input type="hidden" name="target" value="http://www.sumopaint.com/api/index.php#mod" />
<input type="image" src="../images/misc/api.jpg" />
</form>
<?php
if(isset($_POST["data"])) {
$file = "path_where_to_save".uniqid().".png";
$title = $_POST["title"];
$handle = fopen($file,"w");
fwrite($handle, base64_decode($_POST["data"]));
fclose($handle);
print "Modified image ($title):<br><a name='mod'><img src='$file'></a>";
}
?>
</body>
</html> |
Click the image below to modify in Sumo Paint:
| |
|
|
|
|
|