with "jQuery File Upload" - How can i access the preview <img> html element after upload is done ?
Hi, im developing an HTML5 App that utilizes the "jQuery File Upload" plugin to upload images to the CANVAS element.
The user uploads an image, then i use a different library (jCollage) to add the images to the canvas.
So far i was able to achieve this in two steps:
1. first uploading the image.
2. then, when clicking the preview image, an event handler calls an "add image to Canvas" function.
it does this by using the <img> html element.
Now im trying to automate the process so that the first step triggers the second one.
What im missing is a way to access the <img> element of the uploaded image from the "done" callback as there is no reference to it or it has not been created yet:
- // Callback for successful uploads:
- done: function (e, data) {
- ........
-
- //code to add the <img> html element to the canvas
- $.each(data.files, function (index, file) {
-
- jCollage.addLayer(file.context).setTitle(file.attr("title")); // this line is suppose to use "file" as a <img> html element and add it to the CANVAS
- });
- .....
is this the right approach ? or do i need to do this under a different callback after the <img> has already been appended to the preview table ? if so, where ?
Thanks a bunch for this great plugin.