Avatar API
To create an animation, you need to send a POST request in the MULTIPART FORM DATA format to http://remote.luxand.com:8080/request.php, with the following parameters:
- client_name - your user name;
- client_password - MD5 hash of a concatenation of your password with the current date in the "Ymd" format. For example, if your password is "PASSWORD", and the current date is February 4th, 2013 you need to send the MD5 hash of the string "PASSWORD20130204". The API will tolerate a difference of one day from the current date (in the server's time zone);
- morphing_type - for Avatar API, specify the string "smileys";
- client_file - image containing a face in JPG or PNG format;
- sex - specify "0" for female, or "1" for male. When creating e-cards, the value of the parameter is not used;
- resolution - optional parameter; specifies the horizontal resolution to which the output animation should be proportionally resampled;
- smiley_name - the name of the animation to create. While e-cards are available for both sexes, some smileys are available only for males or females. The list of available e-cards and smileys will be sent with the user name and password.
The list of smileys for testing:
http://luxand.com/avatar/smileys_list.txt
The server will send the resulting animation in the animated GIF format. To receive an FLV or H.264 animation, specify an additional POST parameter: 'format' = "flv" or 'format' = "mp4". To receive a sequence of JPG files in a zip archive, specify 'format' = "jpg". In the case of any error, the server will return an error message in plain text.
Note: to be able to play H.264 files your web server should return the correct MIME-type for mp4 files (video/mp4)!
To create multiple animations from the same photo, you need to use the 'smiley_names' parameter (instead of 'smiley_name'), and specify the names of smileys separated by a space. In that case, the server will return a zip archive containing all requested smileys.
Samples
Sample PHP applications and their source code are available at the following links:
Animation saved to MP4 (to uploaded/output.mp4):
http://luxand.com/apidemo/card/index.php
http://luxand.com/apidemo/card/sample.zip (source code)
Animation saved to GIF and displayed on the page:
http://luxand.com/apidemo/smileys-test/index.php
http://luxand.com/apidemo/smileys-test/sample.zip (source code)
Please specify your user name and password in the 'client_name' and 'client_password' fields in the source code. You need to assign just your password to the 'client_password', not an MD5 hash of it, since the example computes this hash before the request. You need also to set the $this_place_url variable accordingly to where the sample is located, and create the "uploaded" directory (the $upload_dir variable) to which the sample saves the uploaded photo.
User Name and Password Request
To request the user name and password, please fill in the following form and we will get back to you as soon as possible: