Skip to content

Commit a75c806

Browse files
author
Maya Shavin
committed
chores: update docs
1 parent fa18da4 commit a75c806

File tree

7 files changed

+180
-8
lines changed

7 files changed

+180
-8
lines changed

docs/url-docs/content/en/examples/advanced.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,24 @@ And display it as `200x200` in size, round and auto-cropping avatar:
1717

1818
```js
1919
import { setConfig, buildImageUrl } from 'cloudinary-build-url'
20+
import { STORAGE_TYPES, RESIZE_TYPES, Gravity } from '@cld-apis/utils'
2021

2122
setConfig({
2223
cloudName: 'your-cloud-name',
2324
})
2425

2526
const url = buildImageUrl('paste-the-copied-path', {
27+
cloud: {
28+
storageType: STORAGE_TYPES.FETCH
29+
},
2630
transformations: {
2731
resize: {
28-
type: 'fill',
32+
type: RESIZE_TYPES.FILL,
2933
width: 200,
3034
height: 200,
3135
},
3236
radius: 'max',
33-
gravity: 'auto:subject'
37+
gravity: Gravity.Subject
3438
}
3539
})
3640
```

docs/url-docs/content/en/examples/basic.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,20 @@ You can easily generate a version of your image as a `200x200` in size, round an
2525

2626
```js
2727
import { buildImageUrl } from 'cloudinary-build-url'
28+
import { RESIZE_TYPES, Gravity } from '@cld-apis/utils'
2829

2930
const url = buildImageUrl('paste-the-copied-path', {
3031
cloud: {
3132
cloudName: 'your-cloud-name',
3233
},
3334
transformations: {
3435
resize: {
35-
type: 'fill',
36+
type: RESIZE_TYPES.FILL,
3637
width: 200,
3738
height: 200,
3839
},
3940
radius: 'max',
40-
gravity: 'auto:subject'
41+
gravity: Gravity.Subject
4142
}
4243
})
4344
```

docs/url-docs/content/en/transformations/image.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ For more detailed information on each transformation, see [Cloudinary Image tran
1919

2020
- Type: `Border`
2121
- `width`: `string` | `number`
22-
- `type`: `string`. Default: `solid`
2322
- `color`: `string`. Default: `black`
2423

2524
Add border around the desired asset.
@@ -33,7 +32,6 @@ const url = buildImageUrl("example", {
3332
},
3433
transformations: {
3534
border: {
36-
type: "solid",
3735
color: "red",
3836
width: 2,
3937
},

docs/url-docs/content/en/usage/transformer.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ version: 1
88

99
In addition to the build URL API, the package exposes an instance of `Transformer`, which can be used to calculate transformations independently.
1010

11-
## `Transformer.transform(options)`
11+
## `transform(options)`
1212

1313
* `options`:
1414
* Type: `TransformerOption`
@@ -42,7 +42,7 @@ console.log(transArr)
4242
4343
See [Transformations](/transformations/basic) for more details on accepted properties for `options`.
4444
45-
## `Transformer.toString(transformations)`
45+
## `toString(transformations)`
4646
4747
* `transformations`:
4848
* Type: `Transformation`
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
title: Constants
3+
description: 'Available constants for transformations and Cloudinary APIs'
4+
position: 14
5+
category: "@cld-apis/utils"
6+
version: 1
7+
---
8+
9+
To make it easier to use Cloudinary transformations, `@cld-apis/utils` provides a set of constants of common-use variables, and pre-defined values for specific transformations.
10+
11+
## `RESOURCE_TYPES`
12+
13+
Available types of resource for uploading in Cloudinary.
14+
15+
## `STORAGE_TYPES`
16+
17+
Storage/Delivery type of the asset stored in Cloudinary.
18+
19+
## `RESIZE_TYPES`
20+
21+
All the accepted cropping types when resizing an image/video.
22+
23+
## `ROTATION_MODES`
24+
25+
Available pre-defined modes for rotating an image/video.
26+
27+
## Effects
28+
29+
Pre-defined effects for transformations.
30+
31+
### `ArtisticFilters`
32+
33+
A set of accepted artistic filters when `effect.name` is `art`.
34+
35+
```js
36+
import { ArtisticFilters } from '@cld-apis/utils'
37+
import { buildImageUrl } from 'cloudinary-build-url'
38+
39+
const src = buildImageUrl('example', {
40+
transformations: {
41+
effect: {
42+
name: 'art',
43+
value: ArtisticFilters.Aurora
44+
}
45+
}
46+
})
47+
```
48+
49+
### `BlurEffects`
50+
51+
Available blur effects for `effect.name`.
52+
53+
### `PixelateEffects`
54+
55+
Available pixelate effects for `effect.name`.
56+
57+
### `Colorblind`
58+
59+
Available colorblind effects for `effect.name` to support a11y (accessibility).
60+
61+
### `Brightness`
62+
63+
Available brightness effects for `effect.name`.
64+
65+
### `Contrast`
66+
67+
Available contrast effects for `effect.name`.
68+
69+
### `ColorChannel`
70+
71+
Available color modification for effect.
72+
73+
### `ColorFilter`
74+
75+
Available color filtering effects.
76+
77+
### `ColorAdjustment`
78+
79+
Available color adjustment effects.
80+
81+
## Flags
82+
83+
Available flags to use with `flags`.
84+
85+
## Gravity
86+
87+
Available pre-defined gravity position for cropping, focusing using smart AI.
88+
89+
## Compass
90+
91+
Available pre-defined focusing direction for resizing images.
92+
93+
## NamedColors
94+
95+
Named colors that can be accepted for Cloudinary color transformations.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
title: Methods
3+
description: 'Helper methods for Cloudinary APIs'
4+
position: 15
5+
category: "@cld-apis/utils"
6+
version: 1
7+
---
8+
9+
`@cld-apis/utils` provides a set of common methods to help using Cloudinary APIs, or being used in between different Cloudinary APIs.
10+
11+
### toSnakeCase(obj)
12+
13+
* `obj` - `Object`
14+
15+
Returns a new object whose properties' names are converted to *snake_case*.
16+
17+
```js
18+
19+
import { toSnakeCase } from '@cld-apis/utils'
20+
21+
const obj = toSnakeCase({
22+
cloudName: '123',
23+
myCamelCase: 'myCamelCase',
24+
})
25+
26+
console.log(obj)
27+
// { cloud_name: '123', my_camel_case: 'myCamelCase' }
28+
```
29+
30+
### colorify(color, prefix)
31+
32+
* `color`
33+
* Type: `String`
34+
* `required`
35+
* A valid CSS color string (named color, 3-4 digit HEX color or 6-8 digit for RGBA color)
36+
* `prefix`
37+
* Type: `String`
38+
* Default: `rgb:`
39+
40+
Returns a converted color string with the prefix if needed. By default it returns the color mapped according to Cloudinary standards for color transformation.
41+
42+
```js
43+
44+
import { colorify } from '@cld-apis/utils'
45+
46+
console.log(colorify('#ffffff')) // rgb:ffffff
47+
```
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: Setup
3+
description: 'How to set up utilities for Cloudinary APIs'
4+
position: 13
5+
category: "@cld-apis/utils"
6+
version: 1
7+
---
8+
## Installation
9+
10+
Add `@cld-apis/utils` dependency to your project:
11+
12+
<code-group>
13+
<code-block label="Yarn" active>
14+
15+
```bash
16+
yarn add @cld-apis/utils
17+
```
18+
19+
</code-block>
20+
<code-block label="NPM">
21+
22+
```bash
23+
npm install @cld-apis/utils
24+
```
25+
26+
</code-block>
27+
</code-group>

0 commit comments

Comments
 (0)