Documentation
Image
upload
Type: String
, Boolean
Default: false
By default, images upload are disabled in the editor. To enable it, specify the path to the server-side uploader, like this:
Revolvapp('#myemail', {
editor: {
path: '/revolvapp-dist/',
template: '/my-folder/template.html'
},
image: {
upload: '/image-uploader/'
}
});
When uploading an image, Revolvapp sends a POST request to the specified path on the server. File is sent as a single file and by default has the key file
. For example, in PHP, this is the array $ _FILES ['file']
.
Here is an example of JSON object which should be return as a response of upload:
{
"url": "image-url-1.jpg",
"id": "some-id"
}
See more how the image upload works.
url
Type: Boolean
Default: true
This setting turns on/off the feature of inserting an image via a direct url. By default is enable. The example below shows how to disable the direct url option.
Revolvapp('#myemail', {
editor: {
path: '/revolvapp-dist/',
template: '/my-folder/template.html'
},
image: {
url: false
}
});
name
Type: String
Default: file
By default, the key of the file array sent to the server is file
. This can be changed like this:
Revolvapp('#myemail', {
editor: {
path: '/revolvapp-dist/',
template: '/my-folder/template.html'
},
image: {
upload: '/image-uploader/',
name: 'image'
}
});
In this example, imageUpload variable name will be image
and it can be retrieved like this (in PHP):
$_FILES['image']
data
Type: Object
, Boolean
Default: false
When uploading images, it is possible to send additional parameters with the same POST request.
Revolvapp('#myemail', {
editor: {
path: '/revolvapp-dist/',
template: '/my-folder/template.html'
},
image: {
upload: '/image-uploader/',
data: {
id: 10,
elements: '#my-input-1, #my-input-2, #my-form'
}
}
});
The example above shows how to send POST params with autosaving. The data object has key=value
params, including values in the input and form fields if the additional object has key elements
with field and form selectors.
The values of the input and form fields are appended as values: field-name: value
.