Open Loyz07 opened 2 years ago
Most likely it means that ImageMagick
is not installed on the machine where you run this code. Also note note that ImageMagick
is one of the pre-installed native modules in Google Cloud Functions (GCF) environment. On MacOS you can install it via Brew:
$ brew update
$ brew install imagemagick
BTW, if you can create a PR with this info added to README.md
that would be awesome!
Hello Kriasoft,
You're right, with ImageMagick installed all works well.
I prepared a branch to create the PR but i don't have the permission to push it on the repo so I don't know how to create a PR. Sorry for that.
I only added the small text: Note that ImageMagick must be installed for this package to work. It is one of the pre-installed native modules in Google Cloud Functions (GCF) environment. On MacOS you can install it via Brew:
brew update
brew install imagemagick
If you plan to deploy this package inside a Docker container, do not forget to install ImageMagick.
For instance, when using node:alpine
base image, add the line below in your Dockerfile.
RUN apk add --no-cache file imagemagick
Hello kriasoft,
First thanks for your job. Very helpful !
I try to use this package within an express server but i face an issue. When i try to display the original image all works fine but when i add a manipulation prefix (for instance w_50), the cache image is generated in the cache bucket but empty 😳.
If i use the createHandler directly in a cloud function all works very well !
Could you help ? Thanks.
Here a sample of my code
` const express = require('express'); const { createHandler } = require('image-resizing');
const app = express(); const port = 3000;
app.get( '/*', createHandler({ sourceBucket: 'gs:///assets',
cacheBucket: 'gs:///cache',
})
);
app.listen(port, () => { console.log(
Example app listening at http://localhost:${port}
); }); `