Code Monkey home page Code Monkey logo

frontend-frameworks's Introduction

Cloudinary Frontend Frameworks

About this project

This project contains SDKs designed to work with Cloudinary url-gen.
These SDKs render CloudinaryImage or CloudinaryVideo objects into the DOM.

Packages contained within this project:


  • The React SDK used to render an image & video component. NPM | {@link ReactSDK|Reference}
  • The Angular SDK used to render an image & video component. NPM | {@link AngularSDK|Reference}

Each SDK also contains advanced features in the form of plugins, which extend the native HTMLImage and HTMLVideo elements.

  • {@link accessibility|accessibility} - Used to make your images more accessible to your users with visual disabilities.
  • {@link lazyload|lazyload} - Used to delay loading images if they are not yet visible on the screen.
  • {@link placeholder|placeholder} - Used to display a lightweight version of an image while the target image is downloading.
  • {@link responsive|responsive} - Used to resize your images automatically based on the viewport size.

Development setup

To build and link project:

  • clone project
  • npm run quickstart

Installation

To get started, install the npm client package of your choice along with our base package. For example, to use Cloudinary in a React environment, the following packages should be installed:

npm i @cloudinary/react @cloudinary/url-gen

Note: To use Angular install @cloudinary/ng.

Simple usage

The following is a simple example using React. For more information on React and other frameworks, navigate to the specific reference using the Packages menu.

// Import the Cloudinary class, and the plugins you want to use.
// In this case, we import a Cloudinary image type, accessibility and responsive.

import React, { Component } from 'react'
import {Cloudinary} from "@cloudinary/url-gen";
import { AdvancedImage, accessibility, responsive } from '@cloudinary/react';

// Once per project/app - configure your instance.
// See the documentation in @cloudinary/url-gen for more information. 
const myCld = new Cloudinary({ cloudName: 'demo'});

// Render your component.
 const App = () => {
    // Create your image.
    // This creates a new image object:
    let img = myCld().image('sample');
    return (
        <div>
            <AdvancedImage cldImg={img} plugins={[responsive(), accessibility()]}/>
        </div>
    )
  };

Plugin Order

We recommend the following order when using our plugins to achieve the best results:

<AdvancedImage plugins={[lazyload(),responsive(), accessibility(), placeholder()]}/>

You can omit any plugin, but the order from above should remain.

frontend-frameworks's People

Contributors

strausr avatar patrick-tolosa avatar kevinkreps avatar iamthehttp avatar carlevison avatar asisayag2 avatar nirmaoz 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.