jquery-image-upload

1.2.0 • Public • Published

jQuery Image Upload

A jQuery plugin that adds controls to the selected jQuery elements with a simple call.

Example

// initialize image upload
$(".image").imageUpload({
    formAction: "/upload"
}).on("imageChanged", function () {
    console.log("Changed the src");
});

Available on CDN

This library is available on CDNJS.

Documentation

Options

Option Name Description Type Values Default
formAction The url that will compute the form data and upload the image on the server. This must respond with a string that represents the new image source. String Any string No default value, but required field
wrapContent The element that must wrap the selected elements. Used only when hover is false String HTML String or jQuery object "<div class='jQuery-imageUpload'>"
inputFileName The name of the file input element. String Any string inputFile
inputFileClass The class of the file input element String Any string inputFile
uploadButtonValue The value (text) of the upload button. String Any string Upload
uploadButtonClass The class of the upload button element String Any string uploadButton
browseButtonValue The value (text) of the browse button element. String Any string Browse
browseButtonClass The class of the browse button element String Any string browseButton
deleteButtonValue The value (text) of the delete button element. String Any string Delete image
deleteButtonClass The class of the delete button element String Any string deleteButton
automaticUpload One click and the image is uploaded. If this is true, the upload button will be hidden. Boolean true/false false
formClass The class of the form String Any string controlForm
hideFileInput If this is true the Browse button will be used and the native file input will be hidden Boolean true/false true
hideDeleteButton Hide or show the delete button. Boolean true/false false
hover Show the controls only on hover. Boolean true/false true
addClass The class that must be added to the wrapper. String Any string jQuery-image-upload
waiter Path to the gif image that should be used as waiter. String Path

Events

The plugin emits the following events:

Event Name Description
imageUpload.reload Destroy and init the plugin
imageUpload.imageChanged Ocures after the source of the image was changed (the image was sucessfully uploaded)
imageUpload.imageChanged Ocures after the source of the image was changed (the image was sucessfully uploaded)
imageUpload.destroy Used to destroy an instance of the plugin

How to contribute

  1. File an issue in the repository, using the bug tracker, describing the contribution you'd like to make. This will help us to get you started on the right foot.
  2. Fork the project in your account and create a new branch: your-great-feature.
  3. Commit your changes in that branch.
  4. Open a pull request, and reference the initial issue in the pull request message.

License

See the LICENSE file.

Readme

Keywords

Package Sidebar

Install

npm i jquery-image-upload

Weekly Downloads

4

Version

1.2.0

License

MIT

Last publish

Collaborators

  • ionicabizau