GithubHelp home page GithubHelp logo

doc22940 / cloudinary-vue Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cloudinary/cloudinary-vue

1.0 1.0 0.0 3.33 MB

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

Home Page: https://cloudinary.com/documentation/vue_integration

JavaScript 80.37% Vue 19.63%

cloudinary-vue's Introduction

Cloudinary Vue SDK

Build Status

Cloudinary is a cloud-based service that provides an end-to-end image and video management solution including uploads, storage, manipulations, optimizations and delivery. All your media resources are optimized and delivered through a fast CDN using industry best practices.

Using Cloudinary's Vue.js SDK, you can easily perform smart image and video manipulations using code that integrates seamlessly with your existing Vue.js application, and deliver optimized and responsive media to your users.

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

๐Ÿ› ๏ธ How to install

๐ŸŽ‰We now support installing via Vue CLI 3.0 ๐ŸŽ‰

Install with Vue-CLI

  1. After create your application with Vue-CLI, navigate to the created app folder, and install Cloudinary SDK by:
vue add cloudinary
  1. Set up your cloudName 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, same level with your main.js file. Feel free to customize it if you like. And have fun with Cloudinary! ๐ŸคŸ

More information on the plugin, check out our Vue-CLI plugin for Cloudinary Repo

Manual install with npm or yarn

Install the package in your project with

npm install cloudinary-vue

#OR

yarn add cloudinary-vue

๐Ÿ’ป Configure

Configure Cloudinary options

  1. In your main.js file (or the main entrance file of your application)
import Vue from "vue";
import Cloudinary from "cloudinary-vue";
  1. You can setup Vue to use Cloudinary plugin without any configuration as below
Vue.use(Cloudinary);

Or setup with some global Cloundinary configurations, such as cloudName

Vue.use(Cloudinary, {
  configuration: { cloudName: "demo" }
  //             ^ cloudinary configuration options
});
  1. Globally you can also select and register which Cloudinary components you'd like to use in your app in an array of components:
import Cloudinary, { CldImage } from "cloudinary-vue";

// specify which components to install in an array
Vue.use(Cloudinary, {
  configuration: { cloudName: "demo" },
  components: [ CldImage ]
});

Or define them in object of components, and rename any component if needed.

import Cloudinary, { CldImage, CldTransformation } from "cloudinary-vue";

Vue.use(Cloudinary, {
  configuration: { cloudName: "demo" },
  components: {
    CldImage,
    CldXf: CldTransformation
    //^ a custom name
  }
});

Notes: By default, if there is no components defined, the plugin will automatically install all available Cloudinary components.

General usage

In order to properly use this library you have to provide it with a few configuration parameters. All configuration parameters can be applied directly to the element, using a CldContext component or while installing a plugin (second argument of Vue.use).

<template>
  <div>
    <h1>Hello, world!</h1>

    <cld-image cloudName="demo" publicId="sample" crop="scale" width="300" />

    <cld-context cloudName="demo">
      <cld-image publicId="sample">
        <cld-transformation crop="scale" width="200" angle="10" />
      </cld-image>
    </cld-context>
  </div>
</template>

Required:

  • cloudName - The cloudinary cloud name associated with your Cloudinary account.

Optional:

  • privateCdn, secureDistribution, cname, cdnSubdomain - Please refer to Cloudinary Documentation for information on these parameters.

Specific usage

The library includes 5 components:

  • CldContext
  • CldTransformation
  • CldImage
  • CldVideo
  • CldPoster (only used together with CldVideo)

CldContext

CldContext allows you to define shared configuration and resource transformation parameters that are applied to all children elements.

CldImage

outputs HTML img tag with a correct src attribute for provided Cloudinary resource, based on configuration and transformation parameters provided as attributes of this component instance, parent CldContext and children CldTransformation instances.

CldVideo

outputs HTML video tag with a correct sources for provided Cloudinary resource, based on configuration and transformation parameters provided as attributes of this component instance, parent CldContext and children CldTransformation instances.

CldPoster (optional)

specify image resource to be provided to poster attribute of the video element

CldTransformation

The Transformation element allows you to defined additional transformations on the parent element. You can also use built-in transformation attribute available in CldImage and CldVideo for the same effect.

For example:

<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>

How to contribute?

See contributing guidelines in a separate file.

Additional resources

Additional resources are available at:

Support

You can open an issue through GitHub.

Contact us at http://cloudinary.com/contact.

Stay tuned for updates, tips and tutorials: Blog, Twitter, Facebook.

Join the Community

Impact the product, hear updates, test drive new features and more! Join here.

License

Released under the MIT license.

cloudinary-vue's People

Contributors

arturkulig avatar asisayag2 avatar cloudinary-jenkins avatar mayashavin avatar meirfeinberg avatar patrick-tolosa avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.