I'm using javascript function to input image.
This is my HTML:
<input type="file" name="filUpload" id="filUpload" onclick="" onchange="showimagepreview(this)">
<br />
<div id="before">
<img id="imgprvw" alt="" class="img-thumbnail" style="width: 250px; height: 250px;" />
And this is my JavaScript:
function showimagepreview(input) { //image preview after select image
if (input.files && input.files[0]) {
var filerdr = new FileReader();
filerdr.onload = function(e) {
url = e.target.result;
image = url;
$('#imgprvw').attr('src', url);
//console.log(url);
//$('#imgprvw').attr('src', e.target.result);
//url = e.target.result;
//$("#imgpath").val(url);
}
filerdr.readAsDataURL(input.files[0]);
}
}
This code convert image to bite array, I need to resize my image using that bite array. Is there any possible methods to do it.
I will pass that binary array to web service. I the image size too high, it takes much time, that's why I need to convert.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…