-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
srcsetMaxWidth returns incorrect image sizes #407
Comments
@khalwat any chance you can take a look at this? |
Yessir, I am away at the moment, but I return on Saturday. It's on my list! |
Addressed in the above commits Craft CMS 3: You can try it now by setting your semver in your "nystudio107/craft-imageoptimize": "dev-develop as 1.6.55”, Then do a ….. Craft CMS 4: You can try it now by setting your semver in your "nystudio107/craft-imageoptimize": "dev-develop-v4 as 4.0.9”, Then do a ….. Craft CMS 5: You can try it now by setting your semver in your "nystudio107/craft-imageoptimize": "dev-develop-v5 as 5.0.2”, Then do a |
Thanks @khalwat! Unfortunately it's not completely fixed: Using See debug info:
|
My bad... Addressed it in the Craft CMS 3: You can try it now by setting your semver in your "nystudio107/craft-imageoptimize": "dev-develop as 1.6.55”, Then do a ….. Craft CMS 4: You can try it now by setting your semver in your "nystudio107/craft-imageoptimize": "dev-develop-v4 as 4.0.9”, Then do a ….. Craft CMS 5: You can try it now by setting your semver in your "nystudio107/craft-imageoptimize": "dev-develop-v5 as 5.0.2”, Then do a |
Thanks! All is working as expected now! |
Describe the bug
image.optimized.srcsetMaxWidth(576)
returns wrong image sizes. I've narrowed it down to here:https://github.com/nystudio107/craft-imageoptimize/blob/v5/src/models/OptimizedImage.php#L642-L644
$set
and$this->variantSourceWidths
are not ordered the same.$set
starts with the smallest size, whilevariantSourceWidths
starts with the largest size. Therefore you can't slice using the index.Example (urls omitted):
$set
:variantSourceWidths
:To reproduce
Steps to reproduce the behaviour:
Returns images with sizes 1440, 1920, 2048
Expected behaviour
Images with sizes 320, 480, 576
Versions
The text was updated successfully, but these errors were encountered: