Actually using Android Photospheres on your website

tldr;

Program to parse the required panoembed information from your JPG: here
PHP file to get around the same-origin policy and let you host your own images: here

The problem

So, Google released some JS software that lets you view Android's Photo Spheres on 'Your Website.' However, the only method described still requires that your photos be uploaded to Picasa / Google+ Albums - the URLs are all rooted in the 'googleusercontent.com' domain and they don't provide an easy way of getting the requires fullsize, croppedsize, offset and displaysize values for the panoembed object.

In order to actually make this work on Your Website without uploading your photos you need to do two things: determine the values needed for the panoembed object and create a JPG download wrapper (so that browsers won't choke on same-origin).

Determining the panoembed values

The values are stored in the JPG file itself it what is commonly known as EXIF (actually XMP). So you may view the properties with any image view that displays these tags. Similarly you can use software such as ExifTool or Exiv2 to view the tags without having to render the image.

Here is a small python script that creates the required html code for a panoembed object. It simply uses the pyexiv2 python package to extract the relevant panoembed objects and formats them for inclusion in your webpage. Usage is basically "python pano-parse.py PANO_your_pano_image.jpg".

Same-origin wrapper

Many modern browsers deter same-origin preventing scripts from one domain to interact with another. Same-origin applies here, because the script origin is going to be https://ssl.gstatic.com and the photo is on your website. The same-origin policy can be laxed in many ways, one way to do this somewhat granularly is to use something like PHP's "header" function like this: "header('Access-Control-Allow-Origin: https://ssl.gstatic.com');" to permit ssl.gstatic.com software to access that URL. So by using a JPG wrapper, like this one you can permit certain sites (of different origin) access.

Working example

Unfortunately, my photographing skills leave something to be desired. Double-clike to zoom to real size, then use the mouse to pan and the scroll-wheel to zoom in and out.