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

Support for Cockpit CMS #156

Open
mikekok opened this issue Jan 2, 2025 · 3 comments
Open

Support for Cockpit CMS #156

mikekok opened this issue Jan 2, 2025 · 3 comments

Comments

@mikekok
Copy link

mikekok commented Jan 2, 2025

Support for Cockpit CMS would be nice.
Their API is pretty straightforward.

image

@ascorbic
Copy link
Owner

ascorbic commented Jan 3, 2025

Can the URLs be manually constructed? Unpic needs the transformer to be a pure, synchronous function with no side effects, so it can't call APIs.

@mikekok
Copy link
Author

mikekok commented Jan 3, 2025

Can the URLs be manually constructed? Unpic needs the transformer to be a pure, synchronous function with no side effects, so it can't call APIs.

The URL can indeed be constructed.
It works the same way as Directus, Shopify etc, by generating an image on the fly, based on the URL parameters (as shown in the picture).

Here's the parameters you'd use to get a 500x500 webp image:
https://example.com/api/assets/image/2fd457c3376537fb3d0001e2?w=500&h=500&mime=webp&re=1

More specifically:
width = w
height = h
format = mime
crop = m

You always have to add re=1 as a parameter in order to be redirected to the actual image.

@ascorbic
Copy link
Owner

ascorbic commented Jan 3, 2025

OK, great. If anyone wants to contribute it they should do so against the new syntax branch which includes uopdated instrucitons on contributing them. It looks like a relatively simple one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants