#StackBounty: #javascript #jquery #html #image How to check width and height from all images has been called by jquery?

Bounty: 50

i have a problem on jquery image, which i need validate all image has been clicked or show with jquery

here is my code, how i add new images and show the images


true_image = false;
var _URL = window.URL || window.webkitURL;
$(document).ready(function(){

    var abc = 0;
    var wrapper         = $(".images");
    var add_button      = $("#add_more");

    var x = 1;
    $(add_button).click(function(){

        x++;
            $(wrapper).append('
" class="remove_field">
'); }); $(wrapper).on("click",".remove_field", function(e){ e.preventDefault(); $(this).parent('div').remove(); x--; }); $('body').on('change', '#file_input', function() { var image ; if (this.files && this.files[0]) { image = new Image; image.onload =function() { console.log("width : "+this.width+" height: "+this.height); if(this.width
"); var reader = new FileReader(); reader.onload = imageIsLoaded; reader.readAsDataURL(this.files[0]); $(this).hide(); $("#abcd" + abc).append($("", { id: 'img', src: '', alt: 'delete' }).click(function() { $(this).parent().parent().remove(); if(($('#file_input').val()) == undefined){ $(wrapper).append('
'); } })); } } }); function imageIsLoaded(e) { $('#previewimg' + abc).attr('src', e.target.result); $('.remove_field').hide(); }; $('body').on('click', '.images_view', function() { abc += 1; var cover = false; var image_id = this.id; $('.images_view').filter(function( index ) { if($( this ).attr( "id" ) === image_id){ $(this).parent().find('#file_input').attr('name','cover'); $(this).parent().find('#cover').remove(); $(this).parent().append("Cover"); }else{ $(this).parent().find('#file_input').attr('name','file[]'); $(this).parent().find('#cover').remove(); } }) }); });

from the above code, i trying to upload multi images so i add a button, and after it was clicked a new <input id="file_input" class="images_file" type="file" name="file[]"/> will be added, than after an images has been selected it could show the images. i want trying to validate the file is an image file, width and height on the image

my problem are, if i selected the false image (not in criteria) the button will be disabled but if in the next select, i choose the true image the button back to normal. I know this will happen because i don’t check the old images that has been selected before, and that is my problem i don’t know how to check it.

guys can you help me how to solve the problem?


Get this bounty!!!