-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
bug(ci): corrupted npm/cdn version 5.2.1 #7830
Comments
related #7787 ? |
ShaMan123
changed the title
fabricjs doesn't load image on node
bug(ci): corrupted npm/cdn version 5.2.1
Mar 27, 2022
duplicate #7787 |
hi @felahdev, is the image.js file your own code? Can you post here image.js? |
First of all many thanks and I'm sorry for disturbing you these last days.
I think I found a temporary solution for this case.
There is the code :
fabric.Image.fromURL('file://'+path_image, function(img) {
let patternSource = new fabric.StaticCanvas();
patternSource.add(img);
patternSource.renderAll();
let pattern = new fabric.Pattern({
source: patternSource.getElement(),
repeat: 'repeat',
});
shape.set({ fill: pattern });
canvas.add(shape);
});
canvas.on('object:added', function() {
/* if u are sure the canvas has only one object u can save canvas here
without fire an event, but in my case I have to count the numbers of
obejects before saving */
//if(canvas.getObjects().length === 5){
canvas.fire('before:save:design');
//}
});
canvas.on('before:save:design', function() {
/**********************************
Save the design
**********************************/
let canvasAsBase64 = canvas.toDataURL();
let data = canvasAsBase64.replace(/^data:image\/\w+;base64,/, "");
fs.writeFile("image.png", data, 'base64', function(err) {
console.log(err);
});
});
Le dim. 27 mars 2022 à 06:09, Shachar ***@***.***> a écrit :
… duplicate #7787 <#7787>
—
Reply to this email directly, view it on GitHub
<#7830 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIDOE6DBWVMON3DCM345AUDVB7UQJANCNFSM5RRTRKHQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version
5.2.1
Test Case
http://jsfiddle.net/fabricjs/Da7SP/
Information about environment
Nodejs
Steps To Reproduce
I have opened a thread https://github.com/fabricjs/fabric.js/issues/7828 and Mr Shachar has replied me and closed the thread :( but the bug still produced
Error Message & Stack Trace
TypeError: Cannot read property 'then' of undefined at Object. (C:\www\fabric\image.js:9:57) at Module._compile (node:internal/modules/cjs/loader:1092:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10) at Module.load (node:internal/modules/cjs/loader:972:32) at Function.Module._load (node:internal/modules/cjs/loader:813:14) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12) at node:internal/main/run_main_module:17:47
Expected Behavior
Actual Behavior
The text was updated successfully, but these errors were encountered: