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

Feature suggestions

Open sarink opened this issue 1 year ago • 1 comments

I have spent the day evaluating both ImageKit and Cloudinary for our business. I wanted to leave a note with some ideas and suggestions for you!

  • Something similar to cloudinary's transformationStringFromObject - manipulating strings is very tedious and confusing for developers. We should be able to leverage a higher level (and typesafe) API
  • Improved extensibility, why doesn't this repo expose the ImageKitContext (it exposes something confusingly named, IKContext, which is not in fact a React.Context at all). If I want to do anything custom, I have to create my own ImageKit, duplicate/pass it all the same parameters that I've already passed to IKContext, including my authenticator. All of that doesn't have to be done twice. This repo should expose the client for consumers to use, which would at least make it easier for them to implement custom behavior and fill any gaps until the feature set catches up.

Thanks for all your hard work!

sarink avatar Sep 25 '24 06:09 sarink

Hey @sarink,

Thank you for taking the time to provide the valuable feedback. We really appreciate your insights and are continuously working on improving our SDKs across the board.

Regarding your point:

Something similar to cloudinary's transformationStringFromObject - manipulating strings is very tedious and confusing for developers. We should be able to leverage a higher level (and typesafe) API

Our React SDK is written in TypeScript and currently supports object-based transformations. For example, you can achieve transformations using the following syntax:

  <IKImage path="/default-image.jpg" transformation={[{
    "height": "200",
    "width": "200"
  }]} />

Could you clarify further what improvements you’re envisioning, or any specific use cases where you feel the current implementation falls short? We'd love to better understand how we can enhance the developer experience.

As for the context-related changes, we already have plans to address those in the next release, which should simplify working with custom behavior.

ahnv avatar Oct 02 '24 04:10 ahnv

  1. For generating transformation, we export .url method on IKCore which allows one to access underlying ImageKit javascript SDK:

    import { IKCore } from "imagekitio-react"
    // Generate image URL
    var imagekit = new IKCore({
        publicKey: "your_public_api_key",
        urlEndpoint: "https://ik.imagekit.io/your_imagekit_id",
    });
    //https://ik.imagekit.io/your_imagekit_id/endpoint/tr:h-300,w-400/default-image.jpg
    var imageURL = imagekit.url({
        path: "/default-image.jpg",
        urlEndpoint: "https://ik.imagekit.io/your_imagekit_id/endpoint/",
        transformation: [{
            "height": "300",
            "width": "400"
        }]
    });
    
  2. Regarding why doesn't this repo expose the ImageKitContext. This is being fixed and will be released very soon. PR https://github.com/imagekit-developer/imagekit-react/pull/170

imagekitio avatar Mar 12 '25 04:03 imagekitio

@sarink Really appreciate your feedback—thank you! We've addressed all the issues you raised in version 5.0.0, which is now live. Docs - https://imagekit.io/docs/integration/react

Not sure if you're currently using ImageKit, but if you're considering it, we'd love to support you with discounts or usage credits.

  • You can now use the buildTransformationString utility function to generate a transformation string from an object.
  • The SDK now exports ImageKitProvider and ImageKitContext, which you can use anywhere in your app to access the effective value of urlEndpoint and transformationPosition. It is a proper React.Context. IKUpload has been removed as it served no meaningful purpose in its current form. Instead, a more powerful utility function (upload) is now being exposed directly.

We’d be excited to hear what you think!

Note: This version includes breaking changes and is a significant upgrade.

imagekitio avatar May 09 '25 11:05 imagekitio