Skip to content

Api For Image Transforms #271

@samuelreichor

Description

@samuelreichor

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 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions