node.js - 如何在 cloudinary [Node js] 中上传多个不同大小的图像
问题描述
例如,我希望上传一张不同尺寸的图片。image_1 是 1080x1080,我想以 200x200、500x500 和原始 1080x1080 等三个不同尺寸将其上传到 Cloudinary。
最后,我想得到三个不同大小图像的不同链接。
我去了文档,但没有发现任何与我的用例相似的东西
await cloudinary.uploader.upload(
imagePath, (err, result) => {
if (err) {
return res.status(400).json({
error: "Failed to upload file",
});
}
console.log(result)
}
);
到目前为止,我的代码上传了一张图片。
解决方案
您可以使用 Cloudinary 的响应式解决方案。您可以构建包含您想要指定的任何图像宽度或高度的动态图像 URL。这意味着您不必预先创建图像,并且您的图像可以根据需要动态调整大小。
欲了解更多信息:https ://cloudinary.com/documentation/responsive_images
推荐阅读
- r - 从两个不同的列满足条件时检索后续行
- arrays - 转换数组
到 Int kotlin 2D 数组 - javascript - React Native 相机 - 多张照片
- typescript - 作为映射键的字符串枚举不适用于 ReturnType
- php - PHP 我应该使用 Filesystem DB 来存储 JSON 文件吗
- django - 如何使用过滤器 django 查询计数?
- json - Json 数据未在 vuejs 中显示
- tibco - TIBCO BW 6.5 调试错误“限定符捆绑名称:Application_Name.module”,需要解决”
- julia - Julia 中是否有一个惰性和迭代的“地图”?
- sql - 在 BigQuery 上创建汇总表,连续聚合多个值