Works with any backend npm install Zero dependencies

Image Gallery

Build a gallery view of uploaded images with lightbox-style preview on click.

var gallery = document.getElementById('gallery');
var uploader = new MultipleUpload(el, {
 uploadUrl: '/api/upload',
 accept: 'image/*',
 onQueueAdd: function(task) {
 var reader = new FileReader();
 reader.onload = function(e) {
 var img = document.createElement('img');
 img.src = e.target.result;
 img.className = 'gallery-thumb';
 img.addEventListener('click', function() { openLightbox(img.src); });
 gallery.appendChild(img);
 };
 reader.readAsDataURL(task.file);
 }
});