Skip to content

Cloudinary components library for Vue.js application, for image and video optimization.

Notifications You must be signed in to change notification settings

cloudinary/cloudinary-vue

Repository files navigation

Cloudinary Vue SDK

Build Status

About

The Cloudinary Vue SDK allows you to quickly and easily integrate your application with Cloudinary. Effortlessly optimize and transform your cloud's assets.

Additional documentation

This Readme provides basic installation and usage information. For the complete documentation, see the Vue SDK Guide.

Table of Contents

Key Features

Version Support

SDK Version Vue 2 Vue 3
1.0.0 - 1.2.3 V X

Installation

Install using Vue-CLI

  • After you create your application with Vue-CLI, navigate to the created app folder, and install Cloudinary SDK by:
    vue add cloudinary
  • Set up your cloud name and pick the components to use (or use all 😃) Set up with cloudName and options
  • A cloudinary.js file will be added to your src directory, at the same level as your main.js file. Feel free to customize it if you like. And have fun with Cloudinary! 🤟
  • For more information on the plugin, check out our Vue-CLI plugin for Cloudinary Repo.

Install using your favorite package manager (yarn, npm)

npm install cloudinary-vue
yarn add cloudinary-vue

Nuxt.js

For Nuxt.js projects, use Cloudinary module. You can set it up by using the following:

yarn add @nuxtjs/cloudinary
# Or
npm i @nuxtjs/cloudinary

Usage

Setup

import Vue from 'vue';
import Cloudinary, { CldImage, CldVideo, CldTransformation, CldContext } from "cloudinary-vue";

Vue.use(Cloudinary, {
  configuration: { cloudName: "demo" },
  components: {
    CldContext,
    CldImage, 
    CldVideo, 
    CldTransformation,
  }
});

You can also import the Cloudinary components manually in each of your components.

Transform and Optimize Assets

  • See full documentation

     // Apply a single transformation
         <cld-context cloudName="demo">
           <cld-image publicId="sample">
             <cld-transformation crop="scale" width="200" angle="10" />
           </cld-image>
         </cld-context>
    // Chain (compose) multiple transformations
    <cld-context cloudName="demo">
       <cld-image cloudName="demo" publicId="sample">
          <cld-transformation angle="-45" />
          <cld-transformation effect="trim" angle="45" crop="scale" width="600" />
          <cld-transformation overlay="text:Arial_100:Hello" />
       </cld-image>
    </cld-context>

Generate Image and Video HTML Tags

- Use <cld-image> to generate image tags
- Use <cld-video> to generate video Tags

File upload

This SDK does not provide file upload functionality, however there are several methods of uploading from the client side.

Contributions

See contributing guidelines.

Get Help

If you run into an issue or have a question, you can either:

About Cloudinary

Cloudinary is a powerful media API for websites and mobile apps alike, Cloudinary enables developers to efficiently manage, transform, optimize, and deliver images and videos through multiple CDNs. Ultimately, viewers enjoy responsive and personalized visual-media experiences—irrespective of the viewing device.

Additional Resources

Licence

Released under the MIT license.