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

Better Api Responses #271

Open
1 of 3 tasks
samuelreichor opened this issue Sep 15, 2024 · 0 comments
Open
1 of 3 tasks

Better Api Responses #271

samuelreichor opened this issue Sep 15, 2024 · 0 comments

Comments

@samuelreichor
Copy link

samuelreichor commented Sep 15, 2024

I'm submitting a...

  • bug report
  • feature request
  • general question

Description

Hii, I am currently building an api to get data of entries because graphql sucks :D I was planning to use your wonderful plugin for providing images.

I would like to be able to flexibly select the transform of the image in the frontend. So at the moment I would have to send every srcset of every image on that page with the api response. This can quickly lead to unnecessary amounts of data.

It would be cool if there was some kind of dynamic url to the image with transformation and width in it.

For example, an api response could look like this:

urls": {
  “16x9": ‘https://example.com/assets/16x9/_WIDTH_/example.jpg’,
  “auto": ‘https://example.com/assets/_WIDTH_/example.jpg’,
  “1x1": ‘https://example.com/assets/1x1/_WIDTH_/example.jpg’,
  “3x2": ‘https://example.com/assets/3x2/_WIDTH_/example.jpg’,
  “3x4": ‘https://example.com/assets/3x4/_WIDTH_/example.jpg’,
  “4x3": ”https://example.com/assets/4x3/_WIDTH_/example.jpg”
}

When calling https://example.com/assets/16x9/800/example.jpg, the example.jpg would then be loaded in 16/9 transform with 800px width. Of course, this assumes that this transform must also exist in imager-x-transforms.php.

And is there a function where I can get all named transforms?

I would be happy if you could share your opinion on this with me :)

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

1 participant