Started photo upload.

This commit is contained in:
Naida Vatric
2020-02-13 17:08:49 +01:00
parent 9bcadffe9c
commit 230ef60158
8 changed files with 713 additions and 810 deletions

View File

@@ -0,0 +1,24 @@
<br>
<input type='file' />
<br>
<img id="myImg" src="#" alt="your image" height=200 width=100>
<script>
function imageIsLoaded() {
alert(this.src); // blob url
// update width and height ...
}
window.addEventListener('load', function() {
document.querySelector('input[type="file"]').addEventListener('change', function() {
if (this.files && this.files[0]) {
var img = document.querySelector('img'); // $('img')[0]
img.src = URL.createObjectURL(this.files[0]); // set src to blob url
img.onload = imageIsLoaded;
}
});
});
</script>