Skip to content

Images can be automatically resized on client-side with browsers supporting the required JS APIs.

Notifications You must be signed in to change notification settings

Garik-/ImageUpload.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 

Repository files navigation

image-upload.js

Description

Image Upload script with multiple file selection and validation for Vanilla.js framework. Support client-side image resizing.

Browsers

Desktop browsers

The Image Upload script is regularly tested with the latest browser versions and supports the following minimal versions:

  • Google Chrome
  • Apple Safari 5.1+
  • Mozilla Firefox 3.5+
  • Microsoft Internet Explorer 10+
  • Opera 12.1+

Mobile browsers

The File Upload plugin has been tested with and supports the following mobile browsers:

  • Apple Safari on iOS 6.0+
  • Google Chrome on iOS 6.0+
  • Google Chrome on Android 4.0+
  • Default Browser on Android 3+
  • Opera Mobile 12.0+

License

Released under the MIT license.

image-resize.js

Описание

Это вспомогательный класс на основе image-upload.js, написан по стандартам ES-2015

Пример использования

'use strict';
import resize from 'image-resize';

let data = new FormData(),
    input = document.querySelector(".upload"),
    previews = document.querySelector(".previews");

input.onchange = event => {
    let files = event.files;
    files.forEach(file => {

        resize(file, 800, 600).then(img => {
            let preview = document.createElement("img");
            preview.src = img.toDataURL();
            previews.appendChild(preview);

            data.append('images[]', img);
        }, error => {
            console.error(error);
        });

    });
};
                  

About

Images can be automatically resized on client-side with browsers supporting the required JS APIs.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published