This sample project covers:
- Setting up ImageKit Vue.js SDK
- Rendering images
- Setting authentication context for the SDK
- Applying common image manipulations
- Adding overlays to images
- Lazy loading images
- Blurred image placeholder
- Client-side file uploading
- Rendering videos
Install dependencies
yarn install
Create .env
file by copying .env.example
cp .env.example .env
Set VUE_APP_IMAGEKIT_URL_ENDPOINT
because urlEndpoint
is the required parameter. You can get the value of URL-endpoint from your ImageKit dashboard - https://imagekit.io/dashboard#url-endpoints.
publicKey
and authenticator
parameters are optional and only needed if you want to use the SDK for client-side file upload. You can get these parameters from the developer section in your ImageKit dashboard - https://imagekit.io/dashboard#developers.
authenticator
expects an asynchronous function that resolves with an object containing the necessary security parameters i.e signature
, token
, and expire
.
# Required variables
VUE_APP_IMAGEKIT_URL_ENDPOINT=https://ik.imagekit.io/your_imagekit_endpoint
# Optional - Only required if you want to upload files
VUE_APP_IMAGEKIT_PUBLIC_KEY=public_XXXXXXXXXXXX
VUE_APP_IMAGEKIT_PRIVATE_KEY=private_XXXXXXXXXXXX
VUE_APP_YOUR_AUTH_ENDPOINT=http://localhost:3001/auth
Run the server
yarn serve
Open the page at http://localhost:8080
Please note that file upload will only work if you have defined VUE_APP_IMAGEKIT_PUBLIC_KEY
, VUE_APP_IMAGEKIT_PRIVATE_KEY
, and VUE_APP_YOUR_AUTH_ENDPOINT
environment variables by setting values in .env
file.
- Offical Vue.js quickstart guide - https://docs.imagekit.io/getting-started/quickstart-guides/vuejs
- Vue.js SDK and documentation - https://github.com/imagekit-developer/imagekit-vuejs
If something doesn't work as expected, report a bug at support@imagekit.io.