Forum Moderators: open
<script>
var pic_real_width, pic_real_height, img;
$(function(){
var btnUpload=$('#upload');
var status=$('#status');
var imgWidth;
var imgHeight;
new AjaxUpload(btnUpload, {
action: 'upload-file.php',
name: 'uploadfile',
onSubmit: function(file, ext){
if (! (ext && /^(jpg|png|jpeg|gif)$/.test(ext))){
// extension is not allowed
status.text('Only JPG, PNG or GIF files are allowed');
return false;
}
status.text('Uploading...');
},
onComplete: function(file, response){
//On completion clear the status
status.text('');
if(response==="success"){
iid = iid + 1;
$('<li></li>').appendTo('#files').html('<div id="UpIm' + iid + '"><img src="./uploads/'+file+'" alt="" id=ImageId"' + iid + '"/><br />'+file + '</div>').addClass('success');
//Somehow get image demensions of non loaded image ----
$("#UpIm" + iid).append('<br>W: ' + iwidth + ' H: ' + iheight); //add image dimensions to div
} else{
$('<li></li>').appendTo('#files').text(file).addClass('error');
}
}
});
});
This is all written in Jquery..
Is there a way to check image dimensions once they reside on the server with Jquery?
...And I would like the original file dimensions, not as they appear in the element. ... I can grab sizes of images already loaded, or off the server...