Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/useflyyer/proxy
Helper function to proxy images via Flyyer network to bypass CORS with Typescript support for Flyyer.io
https://github.com/useflyyer/proxy
cors flyyer image og-image proxy smartcrop twitter-card typescript
Last synced: about 1 month ago
JSON representation
Helper function to proxy images via Flyyer network to bypass CORS with Typescript support for Flyyer.io
- Host: GitHub
- URL: https://github.com/useflyyer/proxy
- Owner: useflyyer
- License: other
- Created: 2021-04-15T02:23:24.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-03-06T00:08:55.000Z (almost 2 years ago)
- Last Synced: 2024-11-08T00:09:21.011Z (about 2 months ago)
- Topics: cors, flyyer, image, og-image, proxy, smartcrop, twitter-card, typescript
- Language: TypeScript
- Homepage: https://flyyer.io
- Size: 1.62 MB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @flyyer/proxy
Helper function to proxy images via flyyer network to bypass CORS with Typescript support.
We made this for [Flyyer.io](https://flyyer.io?ref=github) to enable developers to create content-aware marketing and social images. Beware this is intended to use inside flyyer templates created with [`create-flyyer-app`](https://github.com/useflyyer/create-flyyer-app).
**Note: This proxy service is only available and allowed for flyyer templates where bypassing CORS is necessary for images or data.**
## Usage
Install this dependency:
```sh
yarn add @flyyer/proxy
```Common case usage:
```tsx
import { proxy } from "@flyyer/proxy";export default function MainTemplate({ variables }) {
const src = proxy(variables["image"]);
return
}
```### Smartcrop
![example image](https://github.com/useflyyer/use-smartcrop/raw/main/.github/image.jpeg)
Usage with [`use-smartcrop`](https://github.com/useflyyer/use-smartcrop).
```tsx
import { proxy } from "@flyyer/proxy";
import { useSmartcrop } from "use-smartcrop";export default function MainTemplate({ width, height, variables }) {
const src = proxy(variables["image"]);
const cropped = useSmartcrop(src, { width, height, minScale: 1 })
return
}
```