This file contains hidden or 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
/** | |
* Very simple file drop plugin | |
* @author Arjan Haverkamp - webgear.nl | |
* @date 2019-01-21 | |
*/ | |
(function($) { | |
$.fn.FileDropper = function(options) { | |
var settings = $.extend({ | |
// These are the defaults. |
This file contains hidden or 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
function convertImageToCanvas(image) { | |
var canvas = document.createElement("canvas"); | |
canvas.width = image.width; | |
canvas.height = image.height; | |
canvas.getContext("2d").drawImage(image, 0, 0); | |
return canvas; | |
} | |
function convertCanvasToImage(canvas) { | |
var image = new Image(); |
This file contains hidden or 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
/* HTML: | |
<input type="file" id="filepicker"> | |
<canvas id="outCanvas"></canvas> | |
*/ | |
filepicker.addEventListener("change", () => { | |
createImageBitmap(filepicker.files[0]) | |
.then(response => { | |
outCanvas.width = response.width; | |
outCanvas.height = response.height; |
This file contains hidden or 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
// Plugin: jQuery.draggable | |
// Author: Arjan Haverkamp - webgear.nl | |
// Version: 1.0 | |
// Date: 2019-01-30 | |
(function($) { | |
$.fn.draggable = function(options) { | |
var $document = $(document), settings = $.extend({ | |
// These are the defaults. |
NewerOlder