npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jquery-image-uploader

v1.0.0

Published

JQuery plugin for file uploading

Downloads

2

Readme

jquery-image-uploader

jquery-image-uploader is a jquery plugin to upload file. It supports drag&drop and file API. The plugin has a automatic "fallback" mode.

This plugin is not really production-ready.

Installation

bower install --save jquery-image-uploader

Or copy the dist/jquery.uploader.min.js file on your server.

Usage

Basic usage

$('#dropZone').imageUploader({
    fileField: '#files',
    urlField: '#url',
    url: 'ajaxUpload.php',
    afterUpload: function (data) {
        console.log(data);
    },
    error: function(msg) {
        alert(msg);
    }
});

If you drag and drop an image on the "dropZone" or if you use the classic file button, it will call the url, with the file as an argument. If you specify a url in the "urlField" field, it will call the url with a POST['url'] attribute containing the image url.

Possible options (with default values)

$('#dropZone').imageUploader({
    fileField: null, // the "simple" file input
    urlField: null, // a field which accept an "url", and trigger the upload
    urlFieldSubmit: null, // the submit button for urlField. If null, the urlField gets a "onChange" event

    hideFileField: true, // hide the file field to show only the drop zone
    hideUrlField: true, // hide the url field to show only the drop zone

    url: 'ajaxUpload.php', // the url called for ajax upload

    thumbnails: { // thumbnails options. Set to "false" to hide thumbnails
        div: null, // thumbnails div (ex: "$('#thumbnailsDiv')"), do not set to generate it
        width: null, // thumbnail width, null = image width
        height: null, // thumbnail height, null = image height
        crop: null // null|zoom|fit : null does not crop the image, zoom or fit crop if "width" and "height" are set
    },

    maxFileSize: 0, // an error is thrown if the file is bigger than max. 0 means no validation
    allowDuplicate: false, // set to true to allow multiple upload of a file

    // all callbacks. The most importants are 'afterUpload' and 'error'
    onFilesSelected: function() { return false; },
    onDragLeave: function(event) { return false; },
    onDragEnter: function(event) { return false; },
    onDragOver: function(event) { return false; },
    onDrop: function(event) { return false; },
    onUploadProgress: function(event) { return false; },
    beforeUpload: function() { return true; },
    afterUpload: function() { return false; },
    error: function(msg) { alert(msg); },
    thumbnailReady: $.noop // if you want to change the thumbnail action
});

Advanced usage

You can access the ImageUploader object by getting the imageUploader data attribute. You can then interact on the object itself.

Example

var imgUrl = 'http://octodex.github.com/images/original.png';
$('#dropZone').data('imageUploader').addFileByUrl(imgUrl);