webresizer home

Web Resizer - API

Advanced Integration - Transferring Images

Sending and Saving Images ...

This section outlines advanced integration to use Web Resizer as an image editor for photos in online image galleries. For simple integration follow the Quick Start instructions.

See an example

Images are sent to Web Resizer with the API parameter image_url.

The following code will open fred.jpg in webresizer for editing.

<script type="text/javascript">

var webresizerAPI = new Object;
webresizerAPI.parameters = {
apikey : 'your API Key here', image_url : 'http://mywebsite.com/fred.jpg', allow_uploads : 'no'
};
</script>
<script type="text/javascript"
src="http://api.webresizer.com/ext/js/webresizer_api.js">
</script>

The examples on this page use Object Notation, but Quick Start parameters may also be used if preferred.

You will need to create your own callback routine to save the optimized images to your server. Your callback routine can be as simple or complex as you like depending on your requirements.

Pass the URL of your callback routine to Web Resizer using API parameter uplink_url.

(sample PHP and ASP callback routines are available on the demo page).

Example

The following code will open fred.jpg in webresizer for editing with the link 'Add to My Gallery' showing. Once the user has finished editing the image, control is passed to your callback routine 'transfer.php'. Your callback routine will need to perform validations and save the optimized image to your server.

<script type="text/javascript">

var webresizerAPI = new Object;
webresizerAPI.parameters = {
apikey : 'your API Key here', image_url : 'http://mywebsite.com/fred.jpg', allow_uploads : 'no', is_sample_image : 'no', uplink_text : 'Add to My Gallery', uplink_url : 'http://mywebsite.com/gallery/transfer.php'
};
</script>
<script type="text/javascript"
src="http://api.webresizer.com/ext/js/webresizer_api.js">
</script>

GET parameters

Web Resizer makes the following information available to your callback routine as GET parameters appended to the uplink_url.

url the location of the optimized image
  valid values URL
filename the name of the optimized image
  valid values filename
filesize the size of the optimized image in kilobytes
  valid values numeric
filetype the type of the optimized image
  valid values jpg, gif, png
height the height in pixels of the optimized image
  valid values numeric
width the width in pixels of the optimized image
  valid values numeric

Your callback routine needs to perform all necessary validations. For example, before saving the image to your servers you can check that the image size meets your requirements by checking the 'filesize' value returned. If the image is not the correct size, your callback routine can simply re-open the image in Web Resizer and display a suitable message to the user.

View demos and download sample code here

Please note each API key is unique and authenticated for use on your domain only. The API will not work if you attempt to use someone elses API key or cut and paste the demo API key ... you'll need to sign up first!

Sign Up Now
Copyright 2008 SiteSpace Australia