Skip to content

[5.x]: Graph QL Image Transformations Not Applying. #15718

@BenYarrow

Description

@BenYarrow

What happened?

Description

Previous image transform method is not returning the transformed image data as expected.

Previous GraphQL on Craft CMS version 4.10.6:

thumbnailImage @transform(transform: "c480x480") {
   ... on contentAssets_Asset {
    altText
    height
    url
    width
  }
}

Would return on Craft CMS version 4.10.6:

"thumbnailImage": [
  {
    "altText": "Globe render",
    "height": 480,
    "url": "https://ca1-pnd.edcdn.com/_c480x480/globe-render.png?v=1701685416",
    "width": 480
  }
]. 

Using this query method on Craft CMS version 5.4.2 returns:

"thumbnailImage": [
  {
    "altText": "Landscape 05",
    "height": 1325,
    "url": "https://ca1-fwk.edcdn.com/example-images/landscape-05.jpg?v=1616415716",
    "width": 2000
  }
]

After some time testing different query formats for the transform, the only way i see, to be able to retrieve a transformed url, width and height on Craft CMS version 5.4.2 is with the following qwury:

thumbnailImage {
  altText
  height @transform(transform: "c480x300")
  url @transform(transform: "c480x300")
  width @transform(transform: "c480x300")
}

Steps to reproduce

  1. Add an image to an entry.
  2. Define an image transform and save:
    image
  3. Query that image on that entry using graphQL.

Expected behavior

Return a transformed image url, width and height.

Actual behavior

Returning an untransformed image url, width and height.

Craft CMS version

5.4.2

PHP version

8.2.21

Operating system and version

OS version Darwin 22.5.0

Database type and version

MySQL 8.0.33

Image driver and version

Imagick 3.7.0 (ImageMagick 7.1.1-34)

Installed plugins and versions

Amazon S3 | 2.2.1
Asset Rev | 8.0.0
Cache Manager | 3.1.0
CKEditor | 4.2.0
Elements Panel | 3.0.0
Embedded Assets | 5.1.2
Expanded Singles | 3.0.0
Formie | 3.0.6
Image Resizer | 4.0.1
Maps | 5.0.2
Minify | 5.0.0
Navigation | 3.0.4
Phone Number | 3.0.0-beta.2
Rollbar | 5.0.0
SEO | 5.1.3
Style Inliner | 4.1.1
Table Maker | 5.0.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions