Socket
Book a DemoInstallSign in
Socket

@teamnovu/vue-cloudinary-image

Package Overview
Dependencies
Maintainers
0
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@teamnovu/vue-cloudinary-image

Simple Cloudinary Image component for vue

latest
Source
npmnpm
Version
4.0.1
Version published
Maintainers
0
Created
Source

Vue-Cloudinary-Image

Responsive image component

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

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

// yarn
yarn add @teamnovu/vue-cloudinary-image

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

For vue2 use a version < v3.0.0

Setup

import CloudinaryImage from '@teamnovu/vue-cloudinary-image'

Vue.use(CloudinaryImage, {
  cloudinaryBaseUrl: "https://res.cloudinary.com/<your-cloud-name>/image/upload/",
});

Usage

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

Plugin Options

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

Attributes

AttributeDefaultRequiredTypeDescription
srcnulltrueStringRelative path to image from cloudinaryAssetUrl
quality85falseNumberCloudinary Option
blurnullfalseNumberCloudinary Option
cropnullfalseStringCloudinary Option
format'auto'falseStringCloudinary 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)
aspectRationullfalseNumberIf you set this attribute the component will ignore the placeholderDataUrl attribute and load the placeholder image from cloudinary 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
placeholderQuality30falseNumberCloudinary Option
placeholderWidth300falseNumberCloudinary Option
usePlaceholdertruefalseBooleanIf this attribute is set to false, no placeholder will be displayed and the original image will be rendered immediately
zoomundefinedfalseString, NumberZoom level
sizesundefinedfalseStringFixed sizes attribute for img tag
transformsundefinedfalseString, ObjectAdditional, raw transformations
loading'lazy'falseStringImage loading property. Use loading="eager" to load the image immediately

Example

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

FAQs

Package last updated on 16 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts