Photo size converter
Steps to convert size
1. Choose your file
2. Press conver
3. Then your file will be ready
Photo Size Converter
Photo Size Converter
CSS (style.css):
body {
font-family: Arial, sans-serif;
text-align: center;
margin: 50px;
}
h1 {
color: #333;
}
#result {
margin-top: 20px;
font-weight: bold;
}
JavaScript (script.js):
window.onload = function() {
document.getElementById('convert-btn').addEventListener('click', function() {
var photoInput = document.getElementById('photo');
if (photoInput.files.length > 0) {
var photoSizeInMB = photoInput.files[0].size / (1024 * 1024);
var photoSizeInKB = photoSizeInMB * 1024;
document.getElementById('result').innerText = 'Photo size: ' + photoSizeInKB.toFixed(2) + ' KB';
} else {
document.getElementById('result').innerText = 'Please select a photo first.';
}
});
};
No comments:
Post a Comment