Automatically select image type on upload

This commit is contained in:
Hilal Alsibai
2013-04-02 22:38:37 -07:00
committed by Neil Williams
parent 5f28c1d609
commit 5e0d6a3884

View File

@@ -220,6 +220,14 @@
.replace(/[ _]/g, "-");
$('#img-name').val(f);
}
var ext = file_input.value
.split('.').pop().toLowerCase()
.replace("jpeg", "jpg");
if (ext == 'png' || ext == 'jpg') {
$('input:radio[name=img_type]').attr('checked', false);
$('input:radio[name=img_type][value="' + ext + '"]').attr('checked', true);
}
}
}
function check_name(form) {