Takes a json array and field names. Replaces the value of those field names with a cloudinary url.
npm install @getable/json-image-to-cloudinaryTakes a json array and field names. Replaces the value of those field names with a cloudinary url.
Table of Contents generated with DocToc
- Install
- Usage
- CLI
- Programmatic
- Options
- -h, --help
- -f, --field | field Required
- --overwrite | overwriteImages
- -i, --id | id
- -w, --widths | widths
- --widths-key | widthsKey
- --width-names | widthNames
- Tests
- Developing
- Requirements
- License
``sh`
npm i -S @getable/json-image-to-cloudinary
sh
CLOUDINARY_URL=cloudinary:// && json-image-to-cloudinary data.json -f image
`$3
`js
import from '@getable/json-image-to-cloudinary'jsonImageToCloudinary(docs, options, callback)
`Options
$3
show help$3
Field to replace with a cloudinary url$3
Overwrite data on cloudinary, use this if your urls changed and you're running the script for a second time$3
Generate a cloudinary id from this string. Access keys in the object with ${}. e.g. --id="${category}/${id}"'$3
CLI: A comma separated list of widths to eagerly compute.
Programmatic: An array of integers.$3
Defaults to field + "s", but you can override here$3
CLI: Name a width for output as an object with width urls
e.g. --field=image --widths=50,100 --width-names='small:50,large:100}'Programmatic: An object of width names that map to widths
e.g.
{widths: [50, 100], widthNames: {small: 50, large: 100}}outputs:
``json`
{
"image": "https://cloudinaryurl",
"images": {
"small": "https://cloudinaryurl-at-50",
"large": "https://cloudinaryurl-at-100"
}
}
* npm test will run the testsnpm run tdd
* will run the tests on every file change.
_NOTE: you might need to
sudo ln -s /usr/local/bin/node /usr/bin/node to ensure node is in your path for the git hooks to work_$3
* npm > 2.0.0 So that passing args to a npm script will work. npm i -g npm
* git > 1.8.3 So that git push --follow-tags will work. brew install git`Artistic 2.0 © Joey Baker
[npm-url]: https://npmjs.org/package/@getable/json-image-to-cloudinary
[npm-image]: https://badge.fury.io/js/@getable/json-image-to-cloudinary.svg
[travis-url]: https://travis-ci.org/Getable/@getable/json-image-to-cloudinary
[travis-image]: https://travis-ci.org/Getable/@getable/json-image-to-cloudinary.svg?branch=master
[daviddm-url]: https://david-dm.org/Getable/@getable/json-image-to-cloudinary.svg?theme=shields.io
[daviddm-image]: https://david-dm.org/Getable/@getable/json-image-to-cloudinary