Я создаю изображение resize/crop, и я бы хотел показать предварительный просмотр в прямом эфире после того, как он отредактировал его в модальном (bootstrap). Это должно работать, я считаю, но я просто получаю 0 в console.log. Это требует подачи ширины и высоты исходного изображения в другой script (который я буду делать после этого, просто нужно их в console.log/переменной сейчас)
function doProfilePictureChangeEdit(e) {
var files = document.getElementById('fileupload').files[0];
var reader = new FileReader();
reader.onload = (function(theFile) {
document.getElementById('imgresizepreview').src = theFile.target.result;
document.getElementById('profilepicturepreview').src = theFile.target.result;
}
);
reader.readAsDataURL(files);
var imagepreview = document.getElementById('imgresizepreview');
console.log(imagepreview.offsetWidth);
$('img#imgresizepreview').imgAreaSelect({
handles: true,
enable: true,
aspectRatio: "1:1",
onSelectEnd: preview
});
$('#resizeprofilepicturemodal').modal('show');
};