You can draw both a photograph and a template in canvas. I'm not sure about fabric.js, but if you called canvas functions directly, you just ...
ctx = canvas.getContext('2d'); ctx.DrawImage(user_img, x,y); ctx.DragImage(template_imb, 0, 0);
When the user drags the mouse update x and y and redraws both layers. Obviously, make sure that the hole in the template is transparent. You can add width and height to the DrawImage call if you want the user to be able to resize the image, just provide some kind of control to resize them.
Charles
source share