UploaderPreviewer jQuery Plugin
Here is the UploaderPreviewer jQuery Plugin.
I have tried to do it as complet as possible, but, as I already said, I have not much time right now. I hope to revise it and put a demo somewhere, so it can be seen in action ;)
Though, I have made a simple demo with a little description, so who ever can install and try it out. If you have any question about the plugin, please ask :)
You can find everything attached to this post in two zip files (the maximum file size is 100 KB). Please, uncompress them and join both folders.
I have posted some features of the plugin below.
Hope it may be useful!
- Crossbrower. Firefox, Opera, Chrome, Safari and IE.
- No garbage. The files in the temporary directory are deleted when the user exits or reloads the page
- Descriptive filenames. The file names are constructed with a three random keywords of a given keywords list. If the filename already exists, characters are taken from the unique temporary filename generated by PHP.
- Iframe factory. An iframe factory is used in order not to unnecessary duplicate iframes.
- Loading spinner image. A loading spinner image is displayed while the uploading. It was taken from the website ajaxload.info.
- Loading timeout. A jQuery dialog box is displayed while the saving. It contains a progress bar that shows the elapsed time if there are images loading. If the maximum loading time is reach, the saving process is canceled and an error message is displayed. To test this feature, it can be placed a timer in the php script. For example, place sleep(5); before the return statement, at the end of the script.
- Image type. uploaderPreviewer.js > checkImageType()
- Uploaded files. itemForm.js > validateData()
- Php validations. All in uploadImage.php.
- Upload error.
- File type. File types supported by the script: png, jpg, gif.
- File size. The maximum supported is 3000000.
- File dimension. The maximum supported is 2500.