简体   繁体   English

如何使用 Node.js 从 Cloudinary 检索图像 url?

[英]How do I retrieve an image url from Cloudinary using Node.js?

I uploaded images to cloudinary using cloudinary.uploader.upload(image, public_id:, function(error, result){console.log(result)}) Cloudinary then gives me the image url of the image that I uploaded.我使用cloudinary.uploader.upload(image, public_id:, function(error, result){console.log(result)}) Cloudinary 将图像上传到 cloudinary 然后给我上传的图像的图像 url。

Is there a way to retrieve an image url from Cloudinary using only my cloud name, api key and the public_id of the image?有没有办法只使用我的云名称、api 密钥和图像的 public_id 从 Cloudinary 检索图像 url?

To generate the Cloudinary URL directly via Node JS, you can use the cloudinary.url function.要直接通过 Node JS 生成 Cloudinary URL,可以使用 cloudinary.url function。 It accepts the following:它接受以下内容:

// cloudinary.url("<public_id>.<format>", {<transformations>})  
// Example
cloudinary.url("sample.jpg", {width: 100, height: 150, crop: "fill"})
// Output: "https://res.cloudinary.com/demo/image/upload/w_100,h_150,c_fill/sample.jpg"

Source: https://cloudinary.com/documentation/node_image_manipulation#direct_url_building来源: https://cloudinary.com/documentation/node_image_manipulation#direct_url_building

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM