Layar Developer Documentation

Back to layar.com

Sharing a screenshot to a developer defined URL

In Layar, users can share screenshot on Facebook and Twitter. It is also possible to have users share a screenshot to a URL of a developer's choosing.

Key Steps to Implement

Configuration on the publishing site 

The URL to which the screenshot will be posted is configurable on the Layar publishing site, in the same tab as the API endpoint URL.

If a URL is entered there, a new sharing option will appear on the "screenshot sharing dialog" in the Layar client after a screenshot is taken, next to the Facebook and Twitter options.

Hosted Screenshots - device

How does it work ? 

When selected by the user, Layar will upload the screenshot file to the specified URL as if it were a file uploaded through a web form. In other words, the request will be an HTTP POST with MIME type multipart/form-data. Most web platforms/frameworks will handle this automatically. For example, in PHP uploaded files will be placed in the $_FILES array.

The following parameters are included in the call to the developer supplied URL:

Key Type Description
message string The message that the user entered to go with the screenshot
screenshot file The screenshot the user took

If you need to manually decode the HTTP request, an example body of a screenshot POST call would look like this:

------------ThIs_Is_tHe_bouNdaRY_$

Content-Disposition: form-data; name="message"

This screenshot was taken with the Layar Reality Browser!

------------ThIs_Is_tHe_bouNdaRY_$

Content-Disposition: form-data; name="screenshot"; filename="filename.jpg"

Content-Type: image/jpeg

<binary screenshot data>------------ThIs_Is_tHe_bouNdaRY_$-- 

Resources