Yeah you can, but you need to do it with javascript of course. I build a small function which adds the width and height of the image to the selected image. You can then handle the validation yourself with javascript
function readImage(file, element) {
var reader = new FileReader();
var image = new Image();
reader.readAsDataURL(file);
reader.onload = function (_file) {
image.src = _file.target.result;
image.onload = function() {
$(element).data('height', this.height);
$(element).data('width', this.width);
$(element).data('size', ~~((file.size / 1024) / 1024));
}
}
}
// #background is the <input type="file" id="background">
$('#background').change(function () {
var files = this.files;
if (files && files[0]) {
readImage(files[0], '#background');
}
});
You can use the jquery Validator for example and add a rule like so
jQuery.validator.addMethod('width', function (value, element) {
if ($(element).data('width')) {
return $(element).data('width') >= 800;
}
return true;
}, 'Image needs to be wider than 800px');
jQuery Validator: http://jqueryvalidation.org/