https://github.com/awes-io/resize
Cloudflare Image Resizing: simple API for URL generation.
https://github.com/awes-io/resize
api cloudflare crop cropping image resize resizing
Last synced: 3 months ago
JSON representation
Cloudflare Image Resizing: simple API for URL generation.
- Host: GitHub
- URL: https://github.com/awes-io/resize
- Owner: awes-io
- License: mit
- Created: 2020-02-05T20:10:02.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T08:57:48.000Z (over 2 years ago)
- Last Synced: 2024-02-23T22:43:20.487Z (about 1 year ago)
- Topics: api, cloudflare, crop, cropping, image, resize, resizing
- Language: JavaScript
- Homepage: https://www.awes.io
- Size: 375 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
Cloudflare Image Resizing
>
Simple API for URL generation.
### Setup
```bash
yarn add @awes-io/resize # yarn
npm i @awes-io/resize # npm
```### Basic use
```javascript
import resize from '@awes-io/resize'// get the image with width 640px
resize('https://example.com/images/example.jpg', 640)// result: https://example.com/cdn-cgi/image/w=640,q=75/images/example.jpg
```### Method
```javascript
// URL generation with parameters for resizing
resize(url, width = null, aspect = null, options = null)
```### Options
| Name | Type | Default | Description |
| ---------------- | -------- | ------- | ----------------------------------------------------- |
| url | `String` | - | Link to the original image. |
| width | `Number` | null | (Optional) Width of the image, undefined by default. |
| aspect | `String` | null | (Optional) Aspect ratio for image, ie: 16x9, 4:3, etc.|
| options | `Object` | null | (Optional) domain, protocol, crop, prefix |
| options.options | `Object` | null | (Optional) List of options for modify parameters for image. More info: https://developers.cloudflare.com/images/about/ |### Cloudflare Image Resizing Documentation
- [https://developers.cloudflare.com/images/about/](https://developers.cloudflare.com/images/about/)Ensure to write proper commit message according to [Git Commit convention](https://www.conventionalcommits.org/)