Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Cloudflare custom domain trigger path #543

Open
wants to merge 1 commit into
base: v0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/content/4.providers/cloudflare.md
Expand Up @@ -33,4 +33,4 @@ Default: `/`

Your deployment's domain (zone).

**Note:** `/cdn-cgi/image/` will be automatically appended for generating URLs.
**Note:** `/cdn-cgi/imagedelivery/` will be automatically appended for generating URLs.
4 changes: 2 additions & 2 deletions src/runtime/providers/cloudflare.ts
Expand Up @@ -40,8 +40,8 @@ export const getImage: ProviderGetImage = (src, {
const mergeModifiers = { ...defaultModifiers, ...modifiers }
const operations = operationsGenerator(mergeModifiers as any)

// https://<ZONE>/cdn-cgi/image/<OPTIONS>/<SOURCE-IMAGE>
const url = operations ? joinURL(baseURL, 'cdn-cgi/image', operations, src) : joinURL(baseURL, src)
// https://<ZONE>/cdn-cgi/imagedelivery/<OPTIONS>/<SOURCE-IMAGE>
const url = operations ? joinURL(baseURL, 'cdn-cgi/imagedelivery', operations, src) : joinURL(baseURL, src)

return {
url
Expand Down
10 changes: 5 additions & 5 deletions test/providers.ts
Expand Up @@ -21,7 +21,7 @@ export const images = [
{
args: ['/test.png', { width: 200 }],
ipx: { url: '/_ipx/w_200/test.png' },
cloudflare: { url: '/cdn-cgi/image/w=200/test.png' },
cloudflare: { url: '/cdn-cgi/imagedelivery/w=200/test.png' },
cloudinary: { url: '/f_auto,q_auto,w_200/test' },
twicpics: { url: '/test.png?twic=v1/cover=200x-' },
fastly: { url: '/test.png?width=200' },
Expand All @@ -40,7 +40,7 @@ export const images = [
{
args: ['/test.png', { height: 200 }],
ipx: { url: '/_ipx/h_200/test.png' },
cloudflare: { url: '/cdn-cgi/image/h=200/test.png' },
cloudflare: { url: '/cdn-cgi/imagedelivery/h=200/test.png' },
cloudinary: { url: '/f_auto,q_auto,h_200/test' },
twicpics: { url: '/test.png?twic=v1/cover=-x200' },
fastly: { url: '/test.png?height=200' },
Expand All @@ -59,7 +59,7 @@ export const images = [
{
args: ['/test.png', { width: 200, height: 200 }],
ipx: { url: '/_ipx/s_200x200/test.png' },
cloudflare: { url: '/cdn-cgi/image/w=200,h=200/test.png' },
cloudflare: { url: '/cdn-cgi/imagedelivery/w=200,h=200/test.png' },
cloudinary: { url: '/f_auto,q_auto,w_200,h_200/test' },
twicpics: { url: '/test.png?twic=v1/cover=200x200' },
fastly: { url: '/test.png?width=200&height=200' },
Expand All @@ -78,7 +78,7 @@ export const images = [
{
args: ['/test.png', { width: 200, height: 200, fit: 'contain' }],
ipx: { url: '/_ipx/fit_contain,s_200x200/test.png' },
cloudflare: { url: '/cdn-cgi/image/w=200,h=200,fit=contain/test.png' },
cloudflare: { url: '/cdn-cgi/imagedelivery/w=200,h=200,fit=contain/test.png' },
cloudinary: { url: '/f_auto,q_auto,w_200,h_200,c_scale/test' },
twicpics: { url: '/test.png?twic=v1/inside=200x200' },
fastly: { url: '/test.png?width=200&height=200&fit=bounds' },
Expand All @@ -97,7 +97,7 @@ export const images = [
{
args: ['/test.png', { width: 200, height: 200, fit: 'contain', format: 'jpeg' }],
ipx: { url: '/_ipx/fit_contain,f_jpeg,s_200x200/test.png' },
cloudflare: { url: '/cdn-cgi/image/w=200,h=200,fit=contain,f=jpeg/test.png' },
cloudflare: { url: '/cdn-cgi/imagedelivery/w=200,h=200,fit=contain,f=jpeg/test.png' },
cloudinary: { url: '/f_jpg,q_auto,w_200,h_200,c_scale/test' },
twicpics: { url: '/test.png?twic=v1/output=jpeg/inside=200x200' },
fastly: { url: '/test.png?width=200&height=200&fit=bounds&format=jpeg' },
Expand Down