-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Firefox loadImage error: An attempt was made to use an object that is not, or is no longer, usable #1444
Comments
Thanks for the bug report! Hmm, I'm not sure what's going wrong here--do you think you could provide a self-contained sketch that can serve as a simplified "test case" so we can easily reproduce and debug the problem? |
hey @dennispassway any updates on this? could you give us some sample code as @toolness requested? I'd love to take a look but I'm not currently able to reproduce. |
I'm going to close this for now since we can't seem to reproduce. Please feel free to reopen with the requested simplified test sketch. |
I've found that loadImage function doesn't work for SVG on firefox but does work on chrome and safari. I know SVG isnt explicitly supported but I think that the SVG loading is the issue on firefox. Firefox gives the error:
Super basic example:
Would be great to be able to load the SVG in firefox as it works everywhere else |
This one should be an open issue, @lmccart. My sketch doesn't work in Firefox and works in Safari. It loads SVG same way as @Timothy-Tolley described above. I am on Any work-arounds besides converting image to different format? |
@Timothy-Tolley I understand that it was a while ago but can you check if your svg had Ref: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/image#Specific_attributes Overall, seems like Firefox problem unrelated to p5js. |
@milkyklim This was previously looked at in #2150, to take a link from there If it is the same FIrefox issue, can we close this issue for now? |
@limzykenneth haven't seen the issue you've mentioned but this is exactly the problem. Feel free to close this one! |
I'm trying to load an image and display it with the
display
function. This works fine in all browsers, except for in Firefox where it Throws the error: "An attempt was made to use an object that is not, or is no longer, usable".It is thrown by
p5.Renderer2D.prototype.image
at this line:
this.drawingContext.drawImage(cnv, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight);
This is how I use it:
In this example, Image is a class that creates an object by using this code
It looks like the image onload is called too early when I log
this.logo
it seems fine. Any clues?The text was updated successfully, but these errors were encountered: