Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

101
Views
Lists of uploaded image on fabricjs

i'm trying to create a 3d customizer which have a feature to upload an image. Here's what i use currently

function handleImage(e) {
    var reader = new FileReader();
    reader.onload = function (event) {
        var imgObj = new Image();
        imgObj.src = event.target.result;
        imgObj.onload = function () {
            var image = new fabric.Image(imgObj);
            image.set({
                angle: 0,
                padding: 10,
                cornersize: 10,
                height: 110,
                width: 110,
            });
            canvas.centerObject(image);
            canvas.add(image);
            canvas.renderAll();
        }
    }
    reader.readAsDataURL(e.target.files[0]);
}

then i call that function like this

document.getElementById('uploadedImg').addEventListener('change', function (e) {
    handleImage(e);
})

by using that, i wanted to have a lists of images. so i try calling canvas.getObjects() but it doesn't contains images that i uploaded.

this is my canvas.getObjects() when my app first loaded

enter image description here

and this is after i upload 1 image it return the same value, but if i do canvas._objects my image is listed

enter image description here

but when i try to access it using canvas._objects[1] it returns undefined, same thing if i try to do this

canvas._objects.map(x => console.log(x))

it returns only 1 object, which is my svg

why is that? anyone have any idea why?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!