imagekit-developer / imagekit-angular

Angular SDK for ImageKit.io client side file upload and URL generation
https://imagekit.io
18 stars 20 forks source link

Add service to generate url in component.ts #20

Closed tshenin closed 1 year ago

tshenin commented 3 years ago

Hello, thanks for a nice lib.

I think it might be useful to have some service which can be used in angular component in order to get proper URL.

Possible usage example

Import  { ImagekitService }  from 'imagekitio-angular';

@Component({
    selector: 'app-image-component',
    template: `<img [src]=image />`
})
export class ImageComponent {
    image: string;

    constructor(private imagekitService: ImagekitService) {
        this.image = this.imagekitService.getUrl('path/to/image.png',  [{ width: 300, height: 400 }])
    }
}
imagekitio commented 3 years ago

@tshenin Thanks for the feedback. We could export the imagekit-javascript library because we use it anyway. We are planning to make updates to this SDK in September.

For now, you can directly use the imagekit-javascript SDK to generate the URL. It will add around 2.5KB of extra code to your final bundle (gzipped).

imagekitio commented 1 year ago

Fixed in version 2.0.0.