npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

withlocals-cloudinary

v2.4.1

Published

A package for resizing cloudinary images for react js.

Downloads

124

Readme

withlocals-cloudinary

NPM version

Codeship Status for withlocals/Withlocals-Cloudinary

Usage

Install via npm: npm install withlocals-cloudinary --save

Create a Cloudinary url

This is an example how Cloudinary.createCloudinaryUrl can be used:

var Cloudinary = require('withlocals-cloudinary').Cloudinary;
//...
render: function() {
  return (<img href={Cloudinary.createCloudinaryUrl(url, options)} />);
}
//...

This is an example how options can look like:

var options = {
  width: 200, // int - required
  height: 200, //int - required
  quality: 80, // int
  screenwidth: true, // boolean
  screenheight: true, // boolean
  gravity: 'faces', // string
  gravity2: 'center', // string
  crop: 'fill', // string
  flags: 'progressive', // string
  protocol: 'https://', // string
  radius: "20", // string
  border: "4px_solid_black", // string
  x: 200, // int
  y: 200, // int
  opacity: 80, // int
  background: "rgb:9090ff", // string
  e: 200, // int
  brightness: 80, // int
  saturation: 80, // int
  fetch_format: "auto" // string
}

options should at least have a width and height. For more info about the image transformations you can take a look at the Cloudinary documentation

Exta options, and global variables

For our personal use we added some extra options,

  • private_cdn : this changes your urls from https://res.cloudinary.com/withlocals-com/image/upload/w_200,h_200,c_fill,g_faces,q_60,f_auto/rcgqyevffk4w48z5tdw9 to https://withlocals-com-res.cloudinary.com/image/upload/w_200,h_200,c_fill,g_faces,q_60,f_auto/rcgqyevffk4w48z5tdw9. Which is used for advanced accounts with a private cdn which support ( today 2016 Feb.) HTTP/2
  • cdn_load_balance : for users that want to use subdomain load balancing, i.e. people without http2

All options that are stored in e.g. global.cloudinary_config = {quality:60} or window.cloudinary_config = {quality:60}, depending on your environment, will be taken into account. However they will be overriden by local settings.

React component with a Cloudinary image

This is an example how <CloudinaryImage /> can be used:

var CloudinaryImage = require('withlocals-cloudinary').CloudinaryImage;

//...
render: function() {
  return (<CloudinaryImage
              src={url}
              height={height}
              width={width}
              thumbnail={thumbnail}
              alt={alt} />);
}
//...

src, width and height are required. thumbnail and alt are optional.

Lazy load content

This is an example how <LazyLoad /> can be used:

var LazyLoad = require('withlocals-cloudinary').LazyLoad;

//...
render: function() {
  return (<LazyLoad
              height={height}
              preLoadSize={preLoadSize}>
              //...
          </LazyLoad>);
}  
//...

Lazy load a Cloudinary Image

This is an example how <LazyCloudinaryImage /> can be used:

var LazyCloudinaryImage = require('withlocals-cloudinary').LazyCloudinaryImage;

//...
render: function() {
  return (<LazyCloudinaryImage
              src={url}
              height={height}
              width={width} />);
}  
//...

Development

the webpack command will run jshint and jscs on your code, but gulp will actually build it.

Pull requests are welcome!

Want to publish a new version? Follow these steps:

  1. npm install - install local dependencies
  2. change version number in the package.json
  3. npm publish - publish the code to npm