Sortable image gallery
Several images in one field, previewed before anything uploads. Drag a photo, or use its Move buttons, to reorder; the first one is the cover. Each photo takes alt text, and type, size and count are checked as files arrive.
0of 8 photos
Nothing uploaded yet
Show code
<input type="file" id="gal-input" accept="image/jpeg,image/png,image/webp" multiple> // A preview without uploading: an object URL points straight at the file. img.src = URL.createObjectURL(file); // Reorder by dragging, or with the Move buttons for keyboard users. list.insertBefore(dragged, target.nextSibling);