I am using this code for making my things workaround. By using the below code I'm trying to get the image name and its the size in bytes/Mbps.
'use strict';
const myImages = [];
function addImage(imageBlob) {
myImages.push(imageBlob);
}
function redrawImages() {
const divForImages = document.getElementById('myImages');
divForImages.innerHTML = '';
myImages.forEach((imageBlob) => {
const img = document.createElement('img');
img.src = URL.createObjectURL(imageBlob);
divForImages.appendChild(img);
});
}
function addImageAndRedraw() {
const fileInput = document.getElementById('fileInput');
if (fileInput.files.length === 1) {
addImage(fileInput.files[0]);
redrawImages();
} else {
alert('No file selected. Select a file and try again.');
}
}
const button = document.getElementById('button');
button.addEventListener('click', addImageAndRedraw);
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>My images</h1>
<input id="fileInput" type="file" accept="image/*" multiple="false" value="Select image">
<input id="button" type="button" value="Add image and redraw">
<hr>
<div id="myImages"></div>
<script src="album.js"></script>
</body>
</html>
I have tried to use img.name
but it's deprecated.
How to do it? Any help would be highly appreatiated