weixiyen/jquery-filedrop — pull request #65 by mikelovesrobots (2012-08-10 18:01:33+00:00)
Title: Add beforeSend() hook

We forked your project and added a new (optional) beforeSend() hook so we could asynchronously delay the upload until we had a chance to add image dimensions to the data property.

We needed the asynchronous callback because to get the width and height of an image, we had to actually create an tag, set the src attribute, and then wait for the onload event to fire. Anyway, here's the code that we ended up with in the end:

beforeSend: (file, fileIndex, done) =>
new ImageDimensionFinder file, (width, height) =>
@data.width = width
@data.height = height
done()

Thanks for making the plugin.

Cheers,

- Mike