Skip to content

Image given has not completed loading #289

Closed
@tarunkurapati

Description

@tarunkurapati

Error:
Error: Image given has not completed loading
at /home/f-user/passport-facebook/examples/login/app.js:315:17
at fs.readFile (fs.js:176:14)
at Object.oncomplete (fs.js:297:15)

Code:

var canvas = new Canvas(650, 650)
, ctx = canvas.getContext('2d');
fs.readFile(__dirname + '/public/resimg/1.jpg', function(err, squid){
if (err) throw err;
img = new Canvas.Image;
img.src = squid;
img.onload = function(){
console.log("ian here in onload");
ctx.drawImage(img, 0, 0, img.width / 4, img.height / 4);
}
});

I have seen similar issues here, they mentioned to use "img.onload" in case we get this error "Image given has not completed loading"

But img.onload is not getting fired in my case.
May i know how to fix for this issue.
Thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions