imagekit-nodejs icon indicating copy to clipboard operation
imagekit-nodejs copied to clipboard

Uncaught TypeError: url_1.URLSearchParams is not a constructor

Open veeresh2022 opened this issue 1 year ago • 1 comments

we are trying to implement cropping tool using image kit. with below code

const params = {
        width: completedCrop.width,
        height: completedCrop.height,
        x: completedCrop.x,
        y: completedCrop.y,
      }
      const imgURL = imagekit.url({
        src: imageUrl,
        transformation: [params],
      })

imagekit is an object of ImageKit(...) with private and public keys.

React Version: 18.2.0 Node version: 18.20.1 imagekit version: 5.0.1

veeresh2022 avatar Jun 13 '24 19:06 veeresh2022

Hi @veeresh2022 could you please share you TypeScript version and tsconfig.json file to replicate the issue. Also, if you intend to crop an image, you might be missing some properties. Using only x and y alone will not help you can use cropMode with it. Refer the below code.

const params = {
  width: completedCrop.width,
  height: completedCrop.height,
  x: completedCrop.x,
  y: completedCrop.y,
  cm: "extract"
}
      
const imgURL = imagekit.url({
  src: imageUrl,
  transformation: [params],
})

For more information on ImageKit cropping, refer the docs.

ankur-dwivedi avatar Jun 17 '24 03:06 ankur-dwivedi