Open YodaSpow opened 5 years ago
<!DOCTYPE html>
<html>
<head>
<title>Get memory size of a file</title>
<script type="text/javascript" src="main.js"></script>
</head>
<body onLoad="toGetSize()">
</body>
</html>
function toGetSize() {
var obj = new XMLHttpRequest();
obj.open('HEAD', 'images/1.png', true);
obj.onreadystatechange = function(){
if ( obj.readyState == 4 ) {
if ( obj.status == 200 ) {
alert('Size in bytes: ' + obj.getResponseHeader('Content-Length'));
} else {
alert('ERROR');
}
}
};
obj.send(null);
}
Not fully related: https://stackoverflow.com/questions/934012/get-image-data-url-in-javascript/42916772#42916772 demo: canvas: http://jsfiddle.net/Parth_Raval/rqdw3s71/1/
Is your feature request related to a problem? Please describe. Would like to check if images are too big, not the width or height but the actual KB/MB.
Describe the solution you'd like Thinking any image which over 300KB would get flagged with a pop up.
Describe alternatives you've considered Lists all images in an email that is too large, preferably there would be a tooltip showing
Example from Litmus Rendercheck![Sizes](https://user-images.githubusercontent.com/26332959/64178015-85dfee80-ce58-11e9-834c-a677a3b59010.JPG)