This script is supposed to be executed via phantomjs. It will generate
screenshots of the html files in the directory specified by a commandline
option when these files are served through a webserver which can also be
specified. The screenshots will be saved in the passed directory.
Example usage:
user@host:~/ol3/bin $ phantomjs example-screenshot.js \
http://localhost:8000/ol3/examples/ \
../examples/
The above command will generate `*html.png` files in `tools/` for all html files
that are served through `http://localhost:8000/ol3/examples/`.
So if there is a file `my-humpty-example.html` inside of the relative folder
`../examples/` which is being served through the webserver so that
`http://localhost:8000/ol3/examples/my-humpty-example.html` is a valid and
reachable URL, this script will generate a screenshot and store it as
`../examples/my-humpty-example.html.png`.
The query string `?mode=raw` will be appended to the generated URL.
Known limitations:
As phantomjs doesn't support WebGL (see e.g.
https://github.com/ariya/phantomjs/wiki/Supported-Web-Standards and
http://code.google.com/p/phantomjs/issues/detail?id=273) This won't render
OpenLayers maps rendered through the webglrenderer.
In parts based upon this gist: https://gist.github.com/crazy4groovy/3160121