Skip to content

Commit 89d15a9

Browse files
committed
Merge branch 'master' into gh-pages
2 parents 28110a4 + a0929ac commit 89d15a9

File tree

4 files changed

+39
-30
lines changed

4 files changed

+39
-30
lines changed

README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This jQuery plugin provides an easy way to preview your uploads before they're a
88

99
## How it works
1010

11-
To get access to the not uploaded data, we can use the HTML5 file reader api. This api provides reading local files. This step is pretty important, because we need to this data in order to show it in the browser window. To get more information about the file reader, you can read the [offical documentation](http://www.w3.org/TR/FileAPI/).
11+
To get access to the not uploaded data, we can use the HTML5 file reader api. This api provides reading local files. This step is pretty important, because we need to this data in order to show it in the browser window. To get more information about the file reader, you can read the [official documentation](http://www.w3.org/TR/FileAPI/).
1212

1313
***
1414

@@ -42,7 +42,8 @@ Go to <tt>assets/js/</tt> folder.
4242
label_field: "#image-label", // Default: .image-label
4343
label_default: "Choose File", // Default: Choose File
4444
label_selected: "Change File", // Default: Change File
45-
no_label: false // Default: false
45+
no_label: false, // Default: false
46+
success_callback: null // Default: null
4647
});
4748
});
4849
</script>
@@ -83,4 +84,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
8384
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
8485
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
8586
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
86-
THE SOFTWARE.
87+
THE SOFTWARE.

assets/js/jquery.uploadPreview.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
label_field: ".image-label",
1010
label_default: "Choose File",
1111
label_selected: "Change File",
12-
no_label: false
12+
no_label: false,
13+
success_callback : null,
1314
}, options);
1415

1516
// Check if FileReader is available
@@ -47,6 +48,11 @@
4748

4849
// Read the file
4950
reader.readAsDataURL(file);
51+
52+
// Success callback function call
53+
if(!settings.success_callback) {
54+
settings.success_callback();
55+
}
5056
} else {
5157
if (settings.no_label == false) {
5258
// Change label

assets/js/jquery.uploadPreview.min.js

+3-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.html

+25-25
Original file line numberDiff line numberDiff line change
@@ -94,31 +94,31 @@ <h2>Image File Example</h2>
9494
overflow: hidden;
9595
background-color: #ffffff;
9696
color: #ecf0f1;
97-
input {
98-
line-height: 200px;
99-
font-size: 200px;
100-
position: absolute;
101-
opacity: 0;
102-
z-index: 10;
103-
}
104-
label {
105-
position: absolute;
106-
z-index: 5;
107-
opacity: 0.8;
108-
cursor: pointer;
109-
background-color: #bdc3c7;
110-
width: 200px;
111-
height: 50px;
112-
font-size: 20px;
113-
line-height: 50px;
114-
text-transform: uppercase;
115-
top: 0;
116-
left: 0;
117-
right: 0;
118-
bottom: 0;
119-
margin: auto;
120-
text-align: center;
121-
}
97+
}
98+
#image-preview input {
99+
line-height: 200px;
100+
font-size: 200px;
101+
position: absolute;
102+
opacity: 0;
103+
z-index: 10;
104+
}
105+
#image-preview label {
106+
position: absolute;
107+
z-index: 5;
108+
opacity: 0.8;
109+
cursor: pointer;
110+
background-color: #bdc3c7;
111+
width: 200px;
112+
height: 50px;
113+
font-size: 20px;
114+
line-height: 50px;
115+
text-transform: uppercase;
116+
top: 0;
117+
left: 0;
118+
right: 0;
119+
bottom: 0;
120+
margin: auto;
121+
text-align: center;
122122
}
123123
&lt;/style&gt;
124124

0 commit comments

Comments
 (0)