forked from ondras/my-mind
-
Notifications
You must be signed in to change notification settings - Fork 0
Creating map images
Ondřej Žára edited this page Jan 30, 2014
·
5 revisions
My Mind allows exporting to an image. This is a complicated process which requires a server-side backend to work properly. This page explains how saving to an image works.
From the client's point of view, the image is created in the following steps:
- The map data is serialized and POSTed to a remote URL
- This URL is configurable via
MM.Backend.Image.url
- The request needs to be a HTTP POST, it is not sufficient to send a permalink. The map might not be accessible via permalink (authorization) or might not be saved at all.
- The remote backend processes the request. It can be handled in many ways; My Mind currently ships with a PHP implementation (more possibly to come).
- The remote backend creates an image. While there is no single way to do this, My Mind contains a PhantomJS script that does this.
- The resulting image is sent back to the browser with a
Content-disposition: attachment
header.
- AJAX requests do not prompt for download, even with the mentioned header. This is why the request is made using an invisible
<form>
element.