#Using ImageKit on client side component

4 messages · Page 1 of 1 (latest)

exotic viper
#

Hi I am trying to run imageKit to optimize image on NextJS14
However, I am running into trouble when using a component with "use client".

import imagekit from '../globalComponents/imageKitConfig';

const imageURL = imagekit.url({
src: "https://ik.imagekit.io/jsfia/default-image.jpg?updatedAt=1685008465289",
transformation: [{
height: "300",
width: "400"
}]
});

Will give me:
TypeError: url_1.URLSearchParams is not a constructor

I tried using solution:
if (typeof window === 'undefined') {
imageURL = imagekit.url({
src: "https://ik.imagekit.io/jsfia/default-image.jpg?updatedAt=1685008465289",
transformation: [{
height: "300",
width: "400"
}]
});
}

However, i don't get the image I wanted. just blank image. (error)

fair saddleBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

spring blade
exotic viper