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

[3.x]: asset @transforms won't calculate missing width / height #12137

Closed
riekusdn opened this issue Oct 17, 2022 · 2 comments
Closed

[3.x]: asset @transforms won't calculate missing width / height #12137

riekusdn opened this issue Oct 17, 2022 · 2 comments
Assignees

Comments

@riekusdn
Copy link

riekusdn commented Oct 17, 2022

What happened?

Description

When using the @transform directive in graphql, using "fit" mode and omitting either the width or height argument, the missing argument is not automatically returned based on the assets aspect ratio. From the craft 3.x docs:

If you leave Width or Height blank, that dimension will be set to whatever maintains the image’s aspect ratio. For example, if you have an image that is 600 by 400 pixels, and you set a transform’s Width to 60, but leave Height blank, the resulting height will be 40.

Steps to reproduce

(0. Configure craft to store assets in S3)

  1. Upload an asset
  2. query the asset through graphql and omit 1 of the width / height arguments, i.e: height @transform(width: 780, mode: "fit")
  3. The query returns a null value for the missing argument

Expected behavior

The query automatically returns a value for the omitted argument, based on the assets aspect ration, as described in the docs.

Actual behavior

The query returns a null value for the omitted argument.

Downgrading to Craft 3.7.51 and clearing all the caches fixed the problem for me

Craft CMS version

3.7.56

PHP version

7.4.13

Operating system and version

Linux 5.10.104-linuxkit

Database type and version

MySQL 8.0.29

Image driver and version

GD 7.4.13

Installed plugins and versions

  • Amazon S3 1.3.0
  • Bugsnag 2.1.2
  • Freeform 3.13.17
  • Redactor 2.10.10
  • Redactor custom styles 3.0.4
  • SEOMatic 3.4.37
  • Super table 2.7.2
  • Trigger 0.3.3
@lenvanessen
Copy link

Same for Craft 4, can a fix also be included there?

@brandonkelly
Copy link
Member

Thanks for the report! We just released Craft 3.7.57 and 4.2.8 with a fix (via #12148).

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

No branches or pull requests

4 participants