Here is how a typical ImageKit URL will look like:
- "ik.imagekit.io" is default base URL.
- "demo" is imagekit_ID
- "/" is the default URL pattern
- "tr:w-100" is transformation string
- "default-image.jpg" is the file path
ImageKit ID is the unique identifier for your account that you select at the time of registration. You can find your ImageKit ID in the top-right corner of your ImageKit dashboard. This is the first thing that appears in your URL after the hostname.
A URL pattern is any unique, customisable identifier that will appear in your image URL. A URL pattern can contain only alphabets, numbers and hyphens. Read more about URL pattern here.
This part of the URL is used to specify the transformations and optimizations that you want to perform on an image. The transformation string always begins with the prefix 'tr:' For example – 'tr:w-100'
If you do not want any transformation on your image, except for the default ones, then you can omit this in the URL.
You can read about available transformations here.
Rest of the path
The image is fetched using this URL. This URL will be searched on all the image sources that are available for the URL pattern specified in the URL.
Here are a few examples to understand how URLs are parsed by ImageKit. In these examples, will use ‘demo’ as the ImageKit ID.
1. Default pattern without transformation
The effective URL here is ‘default-image.jpg’.
2. Default pattern with transformation
The transformation string is ‘tr:w-100,h-100’ and the effective URL is ‘default-image.jpg’
3. ‘img’ pattern with transformation
The pattern is ‘img’, the transformation string is ‘tr:w-150,h-150’ and the effective URL is ‘files/sample-file.jpg’.