Last active
June 30, 2018 15:27
-
-
Save fritsvt/5d050192b44cf6e39965640388783bec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>FilePond from CDN</title> | |
<!-- Filepond stylesheet --> | |
<link href="https://unpkg.com/filepond/dist/filepond.css" rel="stylesheet"> | |
<!-- image preview --> | |
<link href="https://unpkg.com/filepond-plugin-image-preview/dist/filepond-plugin-image-preview.css" rel="stylesheet"> | |
</head> | |
<body> | |
<!-- We'll transform this input into a pond --> | |
<input type="file" name="file" class="filepond"> | |
<!-- image preview --> | |
<script src="https://unpkg.com/filepond-plugin-image-preview/dist/filepond-plugin-image-preview.js"></script> | |
<!-- exif --> | |
<script src="https://unpkg.com/filepond-plugin-image-exif-orientation/dist/filepond-plugin-image-exif-orientation.js"></script> | |
<!-- Load FilePond library --> | |
<script src="https://unpkg.com/filepond/dist/filepond.js"></script> | |
<!-- Turn all file input elements into ponds --> | |
<script> | |
// We want to preview images, so we register | |
// the Image Preview plugin, We also register | |
// exif orientation (to correct mobile image | |
// orientation) and size validation, to prevent | |
// large files from being added | |
FilePond.registerPlugin( | |
FilePondPluginImagePreview, | |
FilePondPluginImageExifOrientation, | |
// FilePondPluginFileValidateSize | |
); | |
FilePond.setOptions({ | |
server: 'https://api.boring.host/api/upload' | |
}); | |
// Select the file input and use | |
// create() to turn it into a pond | |
FilePond.create( | |
document.querySelector('input'), | |
); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment