react-transform-cloudinary

1.1.0 • Public • Published

React Cloudinary component

A simple react component to transform images through cloudinary

Getting Started

Cloudinary is a cloud service that offers a solution to a web application's entire image management pipeline.

Integrate cloudinary with your react application with this simple component by giving few important information like cloudName, transformations , image name, type of image uploading etc. and you are good to go

Installation

NPM Install the files using the following command. Use the optional --save parameter if you wish to save the dependency in your package.json file.

npm install react-transform-cloudinary --save

OR

yarn add react-transform-cloudinary

Setup

Include the javascript files in your code. For Example:

import Cloudinary from 'react-transform-cloudinary';

In order to properly use this library you have to provide it with a few configuration parameters.

import React from "react";
import { render } from "react-dom";
import Cloudinary from "react-transform-cloudinary";

const styles = {
  fontFamily: "sans-serif",
  textAlign: "center"
};

const App = () => (
  <div style={styles}>
    <Cloudinary
      alt="image"
      method="<type of upload>"
      uploadedFolder="<folder name in cloudinary>"
      cloudName="<your cloudName>"
      cname="res.cloudinary.com"
      transformation="w_325,h_243,f_auto,q_auto,c_fill,g_auto,fl_progressive"
      image="<absoulte image url>"
      relativeUrl="<relative image url>"
    />
  </div>
);

render(<App />, document.getElementById("root"));

Required:

alt- The alternate text for image if not rendered

method - Type of image uploaded in cloudinary. It can be 'fetch' or 'upload'.

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

cname - Please refer to Cloudinary Documentation for information on these

Optional parameters.

uploadedFolder - The folder name in cloudinary if you are using 'upload' method type

transformation - The images changes you want from cloudinary. See Image transformation reference(https://cloudinary.com/documentation/image_transformation_reference)

image - Absoulte image url

relativeUrl - Relative Image url in case of images are uploaded in a folder in cloudinary and method is 'upload'

Additional resources

Additional resources are available at:

  • Website (https://cloudinary.com/)
  • Documentation (https://cloudinary.com/documentation)
  • Image transformations documentation(https://cloudinary.com/documentation/image_transformation_reference)
  • Support: You can open an issue through GitHub.

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

License

Released under the MIT license.

Readme

Keywords

none

Package Sidebar

Install

npm i react-transform-cloudinary

Weekly Downloads

2

Version

1.1.0

License

MIT

Unpacked Size

6.51 kB

Total Files

4

Last publish

Collaborators

  • eeshtyagi