Add position for picture in JS
Posted: 02 Jun 2021, 04:49
Plessant Coursesweb, I have here an little script
what shows directly in a document from a base-url.
Now I would like to ad manual position height + width when a picture is selected
& run it directly in the document with a form or what?
I did not search for anything because I don`t known
what to search for. So I ask here strait.
In the style I added position + height but this I wanna add manual variable
with a form with direct result when I add a picture
Hope you understand + hoping for an example-support ????
what shows directly in a document from a base-url.
Now I would like to ad manual position height + width when a picture is selected
& run it directly in the document with a form or what?
I did not search for anything because I don`t known
what to search for. So I ask here strait.
Code: Select all
<script>
function showMyImage22(fileInput) {
var files = fileInput.files;
for (var i = 0; i < files.length; i++) {
var file = files[i];
var imageType = /image.*/;
if (!file.type.match(imageType)) {
continue;
}
var img=document.getElementById("thumbnil22");
img.file = file;
var reader = new FileReader();
reader.onload = (function(aImg) {
return function(e) {
aImg.src = e.target.result;
};
})(img);
reader.readAsDataURL(file);
}
}
</script>
with a form with direct result when I add a picture
Code: Select all
<img id="thumbnil22" class="img22" style="left: 230px; top: 230px; width: 100px; height: 100px;" src="empty.jpg" alt="image"/>