.presentationUiUploadImage()
Categories: UI
.presentationUiUploadImage( [ options ] )
Subclass: de_epages
Inherit: (Subclass: de_epages) .widget()
Plugin: de_epages.presentation.ui.uploadImage
Description: Create an image uploader.
The .presentationUiUploadImage()
renders an image uploader, i.e. a div
containing a title, an image, an upload button, a delete button and,
if needed, a checkbox with a label, which determines whether a newly uploaded image will be scaled on the server.
-
Render a basic image uploader with no image previously set.
Code:
<div id='uploadImage-widget'></div>
<script>
de_epages('#uploadImage-widget')
.presentationUiUploadImage();
</script>
-
Render an image uploader with a previously set image,a checkbox with a label. Also, pass along data objects needed for the upload and delete requests.
Code:
<div id='uploadImage-widget'></div>
<script>
de_epages('#uploadImage-widget')
.presentationUiUploadImage({
imagePath : '/WebRoot/Store/Shops/DemoShop/image.jpg',
scaleText : 'Do you want the server to change the image's size during the upload process?',
uploadData : {
ViewAction : 'JSONViewResponse',
ObjectID : 2436278,
ChangeAction : 'UploadSmallProductImage',
Image : 'ImageSmall',
Width : 100,
Height : 100,
UseMediaGallery : 0
},
deleteData : {
ViewAction : 'JSONViewResponse',
ObjectID : 2436278,
ChangeAction : 'DeleteSmallProductImage',
ACCEPT : 1,
File : 'ImageSmall'
}
});
</script>
-
title
version added: 6.15.0
A title string
Default: ''
-
subtitle
version added: 6.15.0
A subtitle string
Default: ''
-
confirmation
version added: 6.15.0
A string which fades in and out after completion of image upload
Default: ''
-
uploadData
version added: 6.15.0
An object containing the parameters needed for the upload action (server-side).
Default: null
-
deleteData
version added: 6.15.0
An object containing the parameters needed for the delete action (server-side).
Default: null
-
saveData
version added: 6.15.0
An object containing the parameters needed for the save action (server-side). Some upload actions do not actually save the uploaded image on the server themselves.
Default: null
-
accept
version added: 6.15.0
A string of MIME types and/or MIME type groups to be accepted by the uploader.
Default: 'image/*'
-
imagePath
version added: 6.15.0
A string containing the link to an image which is to be displayed by the image uploader.
Default: ''
-
defaultImage
version added: 6.15.0
Path to a default image to be displayed after an image has been deleted. Note that only images passed to imagePath will be displayed. This will only show up on screen after an image which was previously set by imagePath was deleted.
Default: ''
-
imageInfo
version added: 6.15.0
An object containing information about the displayed image which is to be shown in the image's tooltip
Default: {Size:null,Width:null,Height:null,FileName:null}
-
scales
version added: 6.15.0
A boolean value determining whether a newly uploaded image will be scaled on the server. If true, the image will be scaled according to the Width and Height properties passed in the uploadData option.
Default: false
-
scaleText
version added: 6.15.0
A string to show in the first line of the image uploader's checkbox. The second line will be rendered according to the properties passed in the Width and Height properties of the uploadData option. Note that, if this is not set at creation of the widget, the respective checkbox and label will not be added to the DOM.
Default: ''
-
confirm
version added: 6.15.0
A bit determining whether to ask the user for confirmation after clicking the delete button.
Default: 1
-
onUpload
version added: 6.15.0
A function to be called after an image was uploaded (and saved) to the server. The callback function receives the imagePath and imageInfo of the uploaded image as arguments.
Default: null
-
onDelete
version added: 6.15.0
A function to be called after an image was deleted from the server. The callback function receives no arguments.
Default: null