79106942

Date: 2024-10-20 11:41:51
Score: 1
Natty:
Report link

Thanks DocAmx for your answer.

I managed to fix my issue by using the following code. The key to my issue was creating a new image object and assigning the imported image as the source. This fixed the null reference error I was getting when Fabic was trying to read the image details:

const testImgObj = new Image(500, 400)
testImgObj.src = selectedMerch.images[0].images[0].name;
const backImg = new FabricImage(testImgObj, {
    left: 0,
    top: 0,
    height: 500,
    width: 600,
    selectable: false,
    hasControls: false,
    hasBorders: false,
    cornerStrokeColor: "#ff0098"
});
canvas.add(backImg);
canvas.setActiveObject(backImg);
Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Rob Hedley