Your upload script
The Resize Any Image API replaces the File Select on your form by set a hidden form fields containing all the information about the resized image.
The RAI_resized_image_url field will contain the location of your resized image on our servers.
In your upload script you will fetch the resized image from our servers using HTTP.
For example:
This code is a simple and none secure example.
Note: make sure that the upload directory is writable by your webserver.
To make the upload script a bit more fool proof you may want to consider the following situations:
Use unique filenames
Instead of saving the file with the filename that was provided by the user you will want to use filename unique to your system
No file was selected by the user
Resize Any Image will not have done anything and your form will be sent as-is.
A file was selected, but not resized
There are several reasons why this might happen:
- The resizer window is closed by user
- The user has a non-compatible browser
Resize Any Image will not have done anything. Your form will be sent as-is.
The image resizer is not available
There are several reasons why this might happen:
- Javascript is disabled in the browser
- The ResizeAnyImage servers are not available - this should not happen off course
Resize Any Image will not have done anything. Your form will be sent as-is, including the default file select.
Result parameters sent by Resize Any Image
These are the parameters that are included in your form:
RAI_resized_image_url |
the location of the resized image on our servers |
RAI_original_image_url |
the filename of the resized image as used on our servers |
last_selection_top |
position of the cropped image in the original image
|
last_selection_left |
last_selection_width |
last_selection_height |
last_zoom |
zoom factor of the original image. A zoom factor of 1000 equals 100% |
last_rotate |
rotation of the original image |
last_page_no |
number of the used layer in multi layered originals like PDF |
A more complete example