1.0.15 • Published 3 years ago

vue-statamic-image v1.0.15

Weekly downloads
53
License
-
Repository
-
Last release
3 years ago

Vue-Statamic-Image

Responsive image component

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

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 i vue-statamic-image

Setup

Vue.use(StatamicImage, {
  statamicBaseUrl: "localhost:3000",
});

Usage

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

Plugin Options

OptionDefaultRequiredTypeComment 
statamicBaseUrlnulltrueString
statamicGlideApiEndpoint/api/imgfalseStringIf this option is not set, the image manipulation features of this component will not work
screenSizesdefault screen sizesfalseObject

Attributes

AttributeDefaultRequiredTypeDescription
srcnulltrueStringRelative path to image from statamicAssetUrl
quality90falseNumber Glide Option
blurnullfalseNumberGlide Option
fitnullfalseStringGlide Option
cropnull falseStringGlide Option
formatnullfalseStringGlide Option
fallbackWidthnullfalseNumberIf srcSet and sizes are not supported in the clients browser, this will be the fixed width of the image itself (not css width)
 aspectRatio null false NumberIf you set this attribute the component will ignore the placeholderDataUrl attribute and load the placeholder image from statamic because the aspect ratio would change between placeholder and the real image
 placeholderDataUrlnullfalseString If this attribute is set all other placeholder options are ignored and this url is used as the placeholder source.
 placeholderBlur100falseNumber Glide Option
placeholderQuality30 falseNumberGlide Option
placeholderWidth400 falseNumberGlide Option
usePlaceholder true falseBooleanIf this attribute is set to false, no placeholder will be displayed and the original image will be rendered immediately

Example

<StatamicImage
  src="/assets/image.jpg"
  format="webp"
  :quality="80"
  placeholderDataUrl="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDo etc"
/>
1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.9

3 years ago

1.0.10

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago