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

Fix SVG scaling bug when using transform with only one dimension value #4643

Closed
wants to merge 1 commit into from

Conversation

auralon
Copy link

@auralon auralon commented Jul 23, 2019

Patches an error (see below) that occurs when using an image transform that only has a defined height (or width) on an SVG asset.

Argument 1 passed to craft\image\Svg::scaleToFit() must be of the type integer, null given, called in ../vendor/craftcms/cms/src/services/AssetTransforms.php on line 1424

Patches an error (see below) that occurs when using an image transform that only has a defined height (or width) on an SVG asset.

Argument 1 passed to craft\image\Svg::scaleToFit() must be of the type integer, null given, called in ../vendor/craftcms/cms/src/services/AssetTransforms.php on line 1424
@andris-sevcenko
Copy link
Contributor

Eh, that's a little unclear about what it accomplishes and deals with the symptoms, not the cause.

@andris-sevcenko
Copy link
Contributor

Just pushed a commit that allows the width to be null, so that height can be used for dimension calculation as well.

Apparently, I don't really learn from past mistakes.

@auralon
Copy link
Author

auralon commented Jul 24, 2019

Hi @andris-sevcenko your patch fixes this issue nicely. Thank you!

@andris-sevcenko
Copy link
Contributor

Thanks for noticing it!

@auralon
Copy link
Author

auralon commented Jul 26, 2019

@andris-sevcenko do you happen to know when|if I'll be able to pull a fix for this on 3.1 any time soon?

@andris-sevcenko
Copy link
Contributor

It's probably not going to happen since updating to 3.2 is pretty seamless and shouldn't be a hurdle for most sites. If you really need this and can't update to 3.2, the safest path is probably fork Craft at the last 3.1 release and apply your own patch to that. That should be safe to use indefinitely since 3.1 is incredibly unlikely to change anymore.

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

Successfully merging this pull request may close these issues.

2 participants