ThumbSnap currently supports .jpg, .gif and .png images upto 2MB in size. If you need support for a different format or larger file size, contact us.
API Method: Upload
API URL: http://thumbsnap.com/api/upload
This is the main API method used to upload images to ThumbSnap
- media - Binary image data. Should be sent as an HTTP POST formatted as multipart/form-data
- key - The API key provided by ThumbSnap
Upon successfully posting an image, an XML formatted document will be returned with a 'mediaurl' which is the full URL to the uploaded photo's page at ThumbSnap. This URL must be linked to any ThumbSnap-hosted thumbnails or images used by your application.
A 'mediaid' will also be returned that can be used to retrieve a thumbnail version of the uploaded image. The thumbnail URL is as follows (notice there is a '.jpg' extension after the 'mediaid' value): http://thumbsnap.com/t/<mediaid>.jpg (Example: http://thumbsnap.com/t/zXsUeHGl.jpg).
A successful image upload will return an XML document as follows:
<?xml version="1.0" encoding="UTF-8"?> <rsp stat="ok"> <mediaid>O1IN8ndS</mediaid> <mediaurl>http://thumbsnap.com/O1IN8ndS</mediaurl> </rsp>
Sample Error Response
If an image upload fails, a message similar to the following will be returned:
<?xml version="1.0" encoding="UTF-8"?> <rsp stat="fail"> <err code="1099" msg="Invalid image format" /> </rsp>
To test out the API or view sample responses, you may use this form.