kriptontr / fireimgoptimizer Goto Github PK
View Code? Open in Web Editor NEWDead simple image resize & optimize module for Firebase Cloud Functions
Dead simple image resize & optimize module for Firebase Cloud Functions
I tried to deploy this function using sharp as resizer, but it seems it takes to long to convert the file. Around ~2 mins.
Is it better to use imagemagick cli instead?
Hi,
first, thank you very much for this tool. It is very useful.
I added the function to my index.js, and I saved the fireImgOptimizer to the same folder as my index.js. I adjusted my package.json as yours, executed npm install successfully (after installing visual studio and C++).
But when deploying the function to firebase the following exception happens:
functions>firebase deploy --only functions
=== Deploying to 'whereareyou-fdb0a'...
i deploying functions
i functions: ensuring necessary APIs are enabled...
i runtimeconfig: ensuring necessary APIs are enabled...
+ runtimeconfig: all necessary APIs are enabled
+ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
i functions: packaged functions (25.16 KB) for uploading
+ functions: functions folder uploaded successfully
i starting release process (may take several minutes)...
i functions: creating function imgOptimizer...
i functions: updating function sendPushNotification...
! functions[imgOptimizer]: Deploy Error: Function load error: Code in file index.js can't be loaded.
Is there a syntax error in your code?
Detailed stack trace: Error: libvips-cpp.so.42: cannot open shared object file: No such file or directory
at Error (native)
at Object.Module._extensions..node (module.js:597:18)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/user_code/node_modules/sharp/lib/constructor.js:8:15)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
! functions[sendPushNotification]: Deploy Error: Function load error: Code in file index.js can't be loaded.
Is there a syntax error in your code?
Detailed stack trace: Error: libvips-cpp.so.42: cannot open shared object file: No such file or directory
at Error (native)
at Object.Module._extensions..node (module.js:597:18)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/user_code/node_modules/sharp/lib/constructor.js:8:15)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
Thats the code that I added to my index.js
let thumbConfig = {
imagePath:"/images",
sizes:{w:180,h:180},
naming:{postfix:"_180x180",prefix:"thumb_"}
};
exports.imgOptimizer = require("./fireImgOptimizer")(thumbConfig);
May you help me?
Thanks in advance.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.