0

寻找这方面的一些想法。我目前使用 Imager - 完美的功能,除了我在较大的图像上遇到内存问题 - 我使用 NodeJits 并且只有很少的内存可以使用。我正在寻找另一种不会将整个图像加载到内存中的解决方案 - 需要执行多个大小并上传到 S3(cloudfiles 可以)。我找到了这个

想法?

4

1 回答 1

0

您可以将此任务卸载到(无服务器)云功能,每个调整大小操作将在单独的 Docker 容器中运行,该容器在 HTTP 请求完成后立即关闭。

这是一个使用image-resizingNode.js/NPM 包的示例:

$ npm install image-resizing --save
const { createHandler } = require("image-resizing");

module.exports.img = createHandler({
  // Where the source images are located.
  // E.g. gs://s.example.com/image.jpg
  sourceBucket: "s.example.com",
  // Where the transformed images needs to be stored.
  // E.g. gs://c.example.com/image__w_80,h_60.jpg
  cacheBucket: "c.example.com",
});

在此处输入图像描述

https://example.com/image.jpg

在此处输入图像描述

https://example.com/w_120,h_120,c_fill/image.jpg
于 2020-09-24T09:41:08.360 回答