https://github.com/peterpme/cloudinary-microurl
A tiny (346B), 0 dependency, fully-tested Cloudinary URL generator for JS
https://github.com/peterpme/cloudinary-microurl
cloudinary cloudinary-url javascript
Last synced: 8 months ago
JSON representation
A tiny (346B), 0 dependency, fully-tested Cloudinary URL generator for JS
- Host: GitHub
- URL: https://github.com/peterpme/cloudinary-microurl
- Owner: peterpme
- License: mit
- Created: 2016-05-03T06:45:37.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T09:45:35.000Z (about 3 years ago)
- Last Synced: 2025-05-21T18:14:52.221Z (9 months ago)
- Topics: cloudinary, cloudinary-url, javascript
- Language: JavaScript
- Homepage: https://npm.im/cloudinary-microurl
- Size: 401 KB
- Stars: 14
- Watchers: 3
- Forks: 3
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🗜 Cloudinary Micro URL[](https://npm.im/cloudinary-microurl) [](https://travis-ci.org/peterpme/cloudinary-microurl)
A tiny (346B), 0 dependency, fully-tested library to generate Cloudinary URLs from an options object.
The official Cloudinary js library is ~600kb. This saves you **1700%**. If this were a crypto coin, you wouldn't be here, would you?
### Installation
```sh
yarn add cloudinary-microurl
```
```sh
npm install cloudinary-microurl
```
### Usage
```es6
const cloudinaryUrl = require('cloudinary-microurl')
const url = cloudinaryUrl('twitter.jpg', {
secure: true,
cloud_name: 'demo',
gravity: 'face',
flags: 'progressive',
quality: 80
})
const img = new Image();
img.src = url
```
### Supported Features
This library supports the following Cloudinary features:
- Fetch format
- Crop
- Effect
- Flags
- Gravity
- Height
- Radius
- Quality
- Width
- Dpr
Here's what they look like in code:
```es6
fetch_format: "f",
crop: "c",
effect: "e",
flags: "fl",
gravity: "g",
height: "h",
radius: "r",
quality: "q",
width: "w",
dpr: "dpr"
```
### Fetch mode
Set `{source: 'fetch'}` to activate cloundinary [fetch mode](http://cloudinary.com/documentation/fetch_remote_images#remote_image_fetch_url). You need to enable it in the [security options](https://cloudinary.com/console/settings/security). The image name should be a full URL.
### Contributions
If there's an effect thats missing, create an Issue or an PR. It's SUPER EASY!
### Thanks to the original author
This library was originally created by [josephg](https://github.com/josephg)