1.0.5 • Published 3 months ago

@teamnovu/vue-bunny-image v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

Vue-Bunny-Image

Responsive image component

Uses the image attributes srcSet and sizes to responsively display an an image from bunny.

Generates srcSet with a placeholder for lazyloading based on screen sizes passed in options and adjusts the sizes attribute depending on the screen size.

Installation

// npm
npm i @teamnovu/vue-bunny-image

Setup

import BunnyImage from '@teamnovu/vue-bunny-image'

Vue.use(BunnyImage, {
  bunnyBaseUrl: "https://<your-cloud-name>.b-cdn.net",
});

Release

To release a new version, run the following command (you need to be in the teamnovu npm organization):

 npm run release

Usage

<BunnyImage src="/assets/image.jpg" />

Plugin Options

OptionDefaultRequiredTypeComment
bunnyBaseUrlnulltrueString
screenSizesdefault screen sizesfalseObject
placeholderTransformationnullfalseStringNamed Transformation used for the placeholder transformation

Attributes

See Bunny Image Processing for details about the options.

AttributeDefaultRequiredTypeDescription
srcnulltrueStringRelative path to image on bunny
widthautofalseNumberBunny Optimizer Option
heightautofalseNumberBunny Optimizer Option
aspect-ratioautofalseStringBunny Optimizer Option
quality85falseNumberBunny Optimizer Option
sharpenfalsefalseBooleanBunny Optimizer Option
blur0falseNumberBunny Optimizer Option
cropnullfalseStringBunny Optimizer Option
crop-gravitycenterfalseStringBunny Optimizer Option
flipfalsefalseBooleanBunny Optimizer Option
flopfalsefalseBooleanBunny Optimizer Option
brightness0falseStringBunny Optimizer Option
saturation0falseStringBunny Optimizer Option
hue0falseStringBunny Optimizer Option
contrast0falseStringBunny Optimizer Option
optimizationnonefalseStringBunny Optimizer Option
sepia0falseStringBunny Optimizer Option
usePlaceholdertruefalseBooleanIf this attribute is set to false, no placeholder will be displayed and the original image will be rendered immediately
aspectRationullfalseNumberIf you set this attribute the component will ignore the placeholderDataUrl attribute and load the placeholder image from bunny because the aspect ratio would change between placeholder and the real image
placeholderDataUrlnullfalseStringIf this attribute is set all other placeholder options are ignored and this url is used as the placeholder source
placeholderQuality30falseNumberbunny Option
placeholderWidth300falseNumberbunny Option

Example

<BunnyImage
  src="/assets/image.jpg"
  :aspect-ratio="1.5"
  :flip="true"
/>
1.0.5

3 months ago

1.0.4

3 months ago

1.0.3

7 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago