https://github.com/imgeng/imageengine-vue3
ImageEngine vue3 module
https://github.com/imgeng/imageengine-vue3
Last synced: about 1 month ago
JSON representation
ImageEngine vue3 module
- Host: GitHub
- URL: https://github.com/imgeng/imageengine-vue3
- Owner: imgeng
- License: mit
- Created: 2023-02-01T08:33:30.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-14T00:35:06.000Z (5 months ago)
- Last Synced: 2025-01-01T10:03:41.937Z (5 months ago)
- Language: TypeScript
- Size: 391 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Vue components for ImageEngine integration
Hassle-free way to deliver optimized responsive images in your Vue applications.
## Quick start
The bundle includes three major components:
* ``
* ``
* ``The only prerequisite to start using them is placing `ImageEngineProvider` somewhere above in the DOM tree with the `deliveryAddress` prop set to your [ImageEngine Delivery Address](https://support.imageengine.io/hc/en-us/articles/360059238371-Quick-Start) :
```vue
import {Image, Source, ImageEngineProvider} from "@imageengine/vue3";
export default {
components: {
ImageComponent: Image,
SourceComponent: Source,
ImageEngineProvider,
},
};```
```vue
import {Image, ImageEngineProvider} from "@imageengine/vue";
export default {
components: {
ImageComponent: Image,
ImageEngineProvider
},
};```
[Demo app on CodeSandbox](https://codesandbox.io/p/sandbox/imageenginevue3demo-nc66jq)
## Component props reference
### ImageEngineProvider
`deliveryAddress` - [ImageEngine Delivery Address](https://support.imageengine.io/hc/en-us/articles/360059238371-Quick-Start):```ts
deliveryAddress: string
````stripFromSrc` - Strip away a portion of a source string in all ImageEngine's components. Particularly useful if your images are coming from a headless CMS and you need to erase something in received URL path (origin, for example):
```ts
stripFromSrc?: string
```### Image
`src` - Relative path to the image:```ts
src: string
````directives` - ImageEngine directives:
```ts
directives?: {
// Define desired width.
width?: number
// Set width to auto (with fallback).
autoWidthWithFallback?: number
// Define desired height.
height?: number
// Adjust compression.
// Possible range: 0-100.
compression?: number
// Define desired output format.
outputFormat?:
| "png"
| "gif"
| "jpg"
| "bmp"
| "webp"
| "jp2"
| "svg"
| "mp4"
| "jxr"
| "avif"
| "jxl"
// Define desired fit method.
fitMethod?: "stretch" | "box" | "letterbox" | "cropbox" | "outside"
// Don't apply any optimizations to the origin image.
noOptimization?: true
// Adjust sharpness.
// Possible range: 0-100.
sharpness?: number
// Define rotation.
// Possible range: -360 to 360.
rotate?: number
// Use WURFL to calculate screen's width and then scale the image accordingly.
// Possible range: 0-100 (float).
scaleToScreenWidth?: number
// Crop the image [width, height, left, top].
crop?: number[]
// Convert the image into a data url.
inline?: true
// Keep EXIF data.
keepMeta?: true
// Force download the image
force_download?: true
//Maximum DPR (Device Pixel Ratio) to consider when resizing an image.
max_device_pixel_ratio: 2.1; // 1-4 float
}
````srcSet` - List of image variations for the image source set:
```ts
srcSet?: [{
// Relative path to the image.
src: string
// Width descriptor.
width: string
// Custom optimization instructions.
directives?: TDirectives
}]
````attributes` - List of additional attributes:
```ts
attributes?: [{
// regular attribute
alt: string
// ...
}]
```### Source
`srcSet` - List of image variations for the image source set:```ts
srcSet?: [{
// Relative path to the image.
src: string
// Width descriptor.
width: string
directives?: TDirectives
}]
````attributes` - List of additional attributes:
```ts
attributes?: [{
// regular attribute, ex. media: '(max-width: 950px)',
// ...
}]
```