I want that to create a process where the users can upload their images and then edit them in the browser in a Canvas with Fabric.js using some buttons -wich uses Fabric.js to add some effects-.
I can't make it work. My HTML is:
<form id="uploadImg" runat="server">
<input type="file" id="uploadedImg"/>
</form>
<canvas id="canvas"></canvas>
The Javascript is the following:
var canvas = new fabric.Canvas('canvas');
canvas.setHeight(480);
canvas.setWidth(640);
$('#uploadedImg').change(function () {
var imgData = $(this).files[0];
fabric.util.loadImage(imgData, function(img) {
var oImg = new fabric.Image(img);
oImg.scale(0.2).set({
left: 100,
top: 100,
});
canvas.add(oImg);
});
});
You can upload multiple image by fabric js and its also draggable one place to another place in canvas.