0
votes

This is my code for uploading images to cloudinary.

let imageArr = [];
    if (media) {
      media && imageArr.push(media.thumbUrl);
    }

    let resultPromise = imageArr.map(async (img) => {
      await cloudinary.uploader.upload(
        img,
        { folder: process.env.STORE_NAME }, //Uploads to Specific Store Folder
        async (err, result) => {
          imageUrls.push(result.secure_url);
        }
      );
    });

But the images are compressing automatically while uploading to 200 * 200 size. The actual size is 1000 * 1000. https://res.cloudinary.com/sreeragcodes/image/upload/v1626531856/igowvkzckmlafwpipc22.png

Is this coding side error or should I configure something in cloudinary? I checked cloudinary but there's no configuration for this

1

1 Answers

0
votes

In the code you shared, you aren't applying any incoming transformation which would be one reason why your images may be resized. If you log into your Cloudinary account and go to your Settings -> Upload tab and scroll down to the Upload Presets section, do you have any default upload preset selected? And if so, does that upload preset have any incoming transformations?

Unless you are applying an incoming transformation as part of a default upload preset, then this transformation wouldn't be applied on the Cloudinary level.

If you're not applying a default upload preset, then I would check the input images and perhaps store the images locally before uploading them to Cloudinary and seeing the size of those.

Note that you are uploading to Cloudinary the thumbUrl of each media. Could it be that this thumbnail URL is has been configured to be 200x200px and would explain why your images are such when uploaded to Cloudinary?