Created
November 23, 2015 14:15
-
-
Save somaria/e8a01b064a4fd27152d4 to your computer and use it in GitHub Desktop.
Prompt a message when image size is too small
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var d = new Date(); | |
| var mth = d.getMonth() + 1; | |
| var str1; | |
| if (mth == 11) { | |
| str1 = '//localhost/wordpress/wp-content/uploads/2015/11/'; | |
| } | |
| else if (mth == 12) { | |
| str1 = '//localhost/wordpress/wp-content/uploads/2015/12/'; | |
| } | |
| var str2 = str1.concat(file.name); | |
| var img = new Image(); | |
| img.onload = function () { | |
| if (this.width < 700) { | |
| alert('The size of the photo is too small.'); | |
| } | |
| } | |
| img.src = str2; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment