Replies: 1 comment 1 reply
-
import { parseURL, extractEntries, resolveConfigs, builtinOutputFormats } from 'image tools-core'
const srcURL = parseURL('file:///example.jpg?w=300;500;700&format=webp')
const parameters = extractEntries(srcURL.searchParams)
const imageConfigs = resolveConfigs(parameters, builtinOutputFormats) For a full working example, just refer to the implementation of |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Can we get a working example for imagetools-core? I tried to use the example of the documentation with an absolute URL:
`import { parseURL, resolveConfigs } from 'imagetools-core'
const src = new URL('file:///example.jpg?w=300;500;700&format=webp')
// parses the url query parameters into an array of entries
const parameters = parseURL(src)
// this function handles the ArgumentList logic
// and produces an array of config objects that can be passed to generateTransforms
const configs = resolveConfigs(parameters)`
But I get an error that rawURL.replace is not a function. "src" returns an object but the parseURL-Function expects a string? Any help is greatly appreciated, I am trying to run imagetools just by executing it via command-line.
Beta Was this translation helpful? Give feedback.
All reactions