You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The noCrop2400x2400 transform is set to 'Fit' and I've set the width and height to 2400 each, so that the longest edge doesn't exceed that value.
In Craft 3.7.42, image.getWidth() and image.getHeight() are returning the correct dimensions of the transformed image. However, in the my dev env, I've updated to Craft 3.7.55.2 and now the getWidth and getHeight are returning the values I have set within the image transform (in this case 2400 x 2400). The actual transform itself is working fine.
I should note that it's not doing this consistently. For some images, it is returning the correct values. I can't see a pattern. All I do know is that it's working 100% consistently in Craft 3.7.42 but not in Craft 3.7.55.2.
Any idea what might have changed? or what I might need to do to get it working as expected?
Expected behavior
image.getWidth('transform') and image.getHeight('transform') should return the width and height of the transformed image.
Actual behavior
image.getWidth('transform') and image.getHeight('transform') are returning the width and height of the values within the transform settings in Craft.
Craft CMS version
3.7.55.2
PHP version
8.0.23
Operating system and version
Darwin 21.6.0
Database type and version
MySQL 5.7.39
Image driver and version
Imagick 3.6.0 (ImageMagick 7.1.0-48)
Installed plugins and versions
Amazon S3: 1.3.0
Element API: 2.8.6.1
Formie: 1.6.14
Mailgun: 2.0.1
Redactor: 2.10.10
SEO: 3.4.38
String Urldecode: 1.0.0
Super Table: 2.7.3
Typed link field: 1.0.25
The text was updated successfully, but these errors were encountered:
garycrane
changed the title
[3.7.55.2]: setWidth() and setHeight() returning the transform setting values, not transformed image values
[3.7.55.2]: setWidth() and setHeight() returning transform setting values, not transformed image values
Sep 28, 2022
And the resulting image is scaled to 375 x 150 (correct aspect ratio) but the <img> tag has its width attribute set to 400 (which is the transform's max-width constraint). So the image appears stretched on the page.
What happened?
Description
We have a production site running Craft 3.7.42 and a template containing the following code:
<a href="{{ image.getUrl('noCrop2400x2400') }}" class="lightbox-trigger" itemprop="contentUrl" data-size="{{ image.getWidth('noCrop2400x2400') }}x{{ image.getHeight('noCrop2400x2400') }}">
The noCrop2400x2400 transform is set to 'Fit' and I've set the width and height to 2400 each, so that the longest edge doesn't exceed that value.
In Craft 3.7.42, image.getWidth() and image.getHeight() are returning the correct dimensions of the transformed image. However, in the my dev env, I've updated to Craft 3.7.55.2 and now the getWidth and getHeight are returning the values I have set within the image transform (in this case 2400 x 2400). The actual transform itself is working fine.
I should note that it's not doing this consistently. For some images, it is returning the correct values. I can't see a pattern. All I do know is that it's working 100% consistently in Craft 3.7.42 but not in Craft 3.7.55.2.
Any idea what might have changed? or what I might need to do to get it working as expected?
Expected behavior
image.getWidth('transform') and image.getHeight('transform') should return the width and height of the transformed image.
Actual behavior
image.getWidth('transform') and image.getHeight('transform') are returning the width and height of the values within the transform settings in Craft.
Craft CMS version
3.7.55.2
PHP version
8.0.23
Operating system and version
Darwin 21.6.0
Database type and version
MySQL 5.7.39
Image driver and version
Imagick 3.6.0 (ImageMagick 7.1.0-48)
Installed plugins and versions
The text was updated successfully, but these errors were encountered: