Image Dimension Limits
Enforce minimum and maximum width/height for image uploads.
(function() {
var logEl = document.getElementById('log');
function log(m) { var d = document.createElement('div'); d.className='pkg-log-entry'; d.textContent=m; logEl.appendChild(d); logEl.scrollTop=logEl.scrollHeight; }
new MultipleUpload('#demo', {
uploadUrl: '/api/upload',
multiple: true,
accept: 'image/*',
minImageWidth: 200,
minImageHeight: 200,
maxImageWidth: 4000,
maxImageHeight: 4000,
onValidationError: function(msg, name) { log((name||'file') + ': ' + msg); }
});
})();Rules in pixels, not bytes
minImageWidth, minImageHeight, maxImageWidth and maxImageHeight all default to 0, meaning unbounded. The dimensions are read in the browser before anything is sent, so a rejection is immediate. minWidth, minHeight, maxWidth and maxHeight are the legacy aliases.
Why file size is the wrong proxy
A logo that is 200 px wide can be a large file, and a 6000 px scan can compress small. If your layout needs a minimum resolution, checking pixels is the only test that answers the actual question — and it lets you tell the user something useful: “needs to be at least 800 px wide” rather than “file too small”.