URL parameters
DPaint.js can be configured using URL parameters.
This is useful for sharing a link to a specific image or for integrating DPaint.js in your webapp.
The following parameters are supported:
file=...
You can directly preload an image into DPaint.js by adding the
file parameter to the URL.
Warning: the server should support CORS to allow loading of assets from other domains.
If the server doesn't support CORS, or if the url is using HTTP instead of HTTPS, DPaint.js will proxy the image through it's own server.
Inevitably, this is slow and a bit wasteful towards my servers' bandwidth, so please try to setup proper CORS headers if you are using this feature.
Example:
presentation=true
You can start DPaint.js in presentation mode by adding the
presentation=true parameter to the URL.
This is useful for displaying image formats that are not supported directly by the browser or by ensuring a sharp pixel zoom for your pixel-art images
Users can zoom and pan the image.
They can exit the presentation mode at any time to return to the editor.
Example:
play=true
Use in combination with the
file parameter.
If the image is "playable" (e.g. a gif or an animation, or an image that has Color Cycle ranges), you can start playback immediately by adding the
play=true parameter to the URL.
Example:
zoom=true
Use in combination with the
file parameter.
Set the zoom to fill the available screen space after the image is loaded.
Example:
gallery=true
Opens the gallery after startup and loads the first image from the gallery.
Example:
postback=...
putback=...
You can use the
postback and
putback parameters to define a URL where the image data will be sent to when the user clicks the "Save" button.
The image will be posted as raw binary data.
If your endpoint expects a PUT request, use the
putback parameter.
If your endpoint expects a POST request, use the
postback parameter.
Warning: the server should support CORS to allow calling your endpoints from other domains.
Together with the
file parameter, this allows a nicely integrated roundtrip to integrate DPaint.js in your own system, providing an easy image-editing flow that loads from and saves to your own API.