Varad Gauthankar
Varad Gauthankar

Reputation: 105

how to upload multiple images of different sizes in cloudinary [Node js]

I am looking to upload one single image in different sizes for example. image_1 which is 1080x1080, I want to upload it to Cloudinary in three different dimensions like 200x200, 500x500, and the original 1080x1080.

In the end, I want to get three different links of different sizes of images.

I went to the docs but didn't found anything similar to my use case

  await cloudinary.uploader.upload(
         imagePath, (err, result) => {
            if (err) {
              return res.status(400).json({
                error: "Failed to upload file",
              });
            }
            console.log(result)
          }
        );

my code so far that uploads an image.

Upvotes: 0

Views: 663

Answers (1)

Akshay Joshi
Akshay Joshi

Reputation: 49

You can use Cloudinary's responsive solution. You can build dynamic image URLs that include any image width or height you want to be specified. This means you don't have to pre-create the images, and your images are dynamically resized on-the-fly as needed.

For more information: https://cloudinary.com/documentation/responsive_images

Upvotes: 1

Related Questions