roland_susan
Forum Replies Created
-
Forum: Plugins
In reply to: [Comment Images] [Plugin: Comment Images] Size limithello,
I correct myself.The problem with the theme Webfolio was silly, “document.forms [1]” instead of “document.forms [0]”.
the problem of error image is added, I fixed it by adding a couple of lines. To see what you think:
<script> document.forms[1].addEventListener('submit', function( evt ) { var file = document.getElementById('comment_image').files[0]; if(file && file.size < 153600) { // 150k (this size is in bytes) //Submit form } else if (!file){ //Submit form } else { //Prevent default and display error alert('Tu imagen tiene un tama\u00f1o superior a 150Kb, reduce su tama\u00f1o o env\u00edanosla por email.'); document.getElementById('comment_image').value = ''; evt.preventDefault(); } }, false); </script>
works for me, let me know if you see any corrections.
Greetings!
Forum: Plugins
In reply to: [Comment Images] [Plugin: Comment Images] Size limitI stand corrected. The code works perfectly.
In twenty twelve theme and I suppose in other wordpress.The problem is the theme I use, Webfolio.
Do not get it to work there.
Anyone know what can be wrong?
Thanks and apologies for the misunderstanding.Forum: Plugins
In reply to: [Comment Images] [Plugin: Comment Images] Size limitHi, I have the same problem with the very good comment images plugin. I want to set a limit on the size of the images uploaded.
I tried with<script> document.forms[0].addEventListener('submit', function( evt ) { var file = document.getElementById('comment_image').files[0]; if(file && file.size < 153600) { // 150k (this size is in bytes) //Submit form } else { //Prevent default and display error alert('File size is too large, please reduce and try again'); evt.preventDefault(); } }, false); </script>
at the end of comments.php but I can not make it work.
I use the latest version of worpress and Webfolio Theme.Any idea that this solution is working for me? Thank you and sorry for my google english.