Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Helper function to proxy images via Flyyer network to bypass CORS with Typescript support for Flyyer.io

License

Notifications You must be signed in to change notification settings

useflyyer/proxy

Repository files navigation

@flyyer/proxy

Helper function to proxy images via flyyer network to bypass CORS with Typescript support.

We made this for Flyyer.io 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.

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:

yarn add @flyyer/proxy

Common case usage:

import { proxy } from "@flyyer/proxy";
export default function MainTemplate({ variables }) {
 const src = proxy(variables["image"]);
 return <img src={src} />
}

Smartcrop

example image

Usage with use-smartcrop.

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 <img src={cropped.src} />
}

About

Helper function to proxy images via Flyyer network to bypass CORS with Typescript support for Flyyer.io

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

AltStyle によって変換されたページ (->オリジナル) /