cloudinary-microurl
Advanced tools
Comparing version 1.0.2 to 1.1.0
{ | ||
"name": "cloudinary-microurl", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "A tiny library to generate cloudinary URLs from options objects", | ||
@@ -5,0 +5,0 @@ "main": "url.js", |
@@ -6,3 +6,3 @@ # Cloudinary URL | ||
Cloudinary's official JS library is ~600k (including all of lodash). Its much | ||
too big for use in the browser. This one is ~1k. | ||
too big for use in the browser. This one minifies to under 1k. | ||
@@ -19,7 +19,7 @@ | ||
```javascript | ||
const url = require('cloudinary-microurl'); | ||
const cloudurl = require('cloudinary-microurl'); | ||
// ... | ||
const img = new Image; | ||
img.src = url('my_cool_image', { | ||
// 'https://res.cloudinary.com/demo/image/upload/fl_progressive,g_face,q_80/my_cool_image' | ||
const url = cloudurl('my_cool_image', { | ||
secure: true, | ||
cloud_name: 'demo', | ||
@@ -30,12 +30,37 @@ gravity: 'face', | ||
}); | ||
// Then use it. | ||
const img = new Image; | ||
img.src = url; | ||
``` | ||
### Missing features | ||
### Feature support | ||
This library is missing a bunch of cloudinary features. If you want to add them, fork the library or submit a PR. I've only added the cloudinary features I actually use. | ||
This library only supports the following cloudinary features: | ||
- Secure | ||
- Crop | ||
- Effect | ||
- Fetch format | ||
- Flags | ||
- Gravity | ||
- Width / height | ||
- Radius | ||
- Quality | ||
Adding more cloudinary features is super easy, but I can't find a master list | ||
so I just added the features I use. If you need more features, please submit a | ||
PR. | ||
### 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. | ||
### Maintainance | ||
I never wanted to write this library. If you want to maintain it, [send me an email](mailto:me@josephg.com). | ||
This is a library bourne of necessity, not love. I don't want to maintain this | ||
library going forward. If you want to maintain it, [send me an | ||
email](mailto:me@josephg.com). |
@@ -29,2 +29,3 @@ // Example options: | ||
var scheme = options.secure ? 'https' : 'http'; | ||
var source = options.source || 'upload'; | ||
var cloud_name = options.cloud_name; | ||
@@ -49,5 +50,5 @@ if (!cloud_name) throw Error('Missing required options.cloud_name'); | ||
+ encodeURIComponent(options.cloud_name) | ||
+ '/image/upload/' + urlParams | ||
+ '/image/' + source + '/' + urlParams | ||
+ encodeURIComponent(id); | ||
}; | ||
4159
73
64