3.0 source code

This commit is contained in:
agolybev
2015-04-28 17:59:00 +03:00
parent c69fd34bdd
commit 7b3b2248e5
16311 changed files with 1445974 additions and 3108429 deletions

View File

@@ -0,0 +1,23 @@
window.onload = function() {
var fileInput = document.getElementById('fileInput');
fileInput.onchange = function() {
var file = fileInput.files[0];
// MegaPixImage constructor accepts File/Blob object.
var mpImg = new MegaPixImage(file);
// Render resized image into image element using quality option.
// Quality option is valid when rendering into image element.
var resImg = document.getElementById('resultImage');
mpImg.render(resImg, { maxWidth: 300, maxHeight: 300, quality: 0.5 });
// Render resized image into canvas element.
var resCanvas1 = document.getElementById('resultCanvas1');
mpImg.render(resCanvas1, { maxWidth: 300, maxHeight: 300 });
// Render resized image into canvas element, rotating orientation = 6 (90 deg rotate right)
// Types of orientation is defined in EXIF specification.
// To detect orientation of JPEG file in JS, you can use exif.js from https://github.com/jseidelin/exif-js
var resCanvas2 = document.getElementById('resultCanvas2');
mpImg.render(resCanvas2, { maxWidth: 300, maxHeight: 300, orientation: 6 });
};
};