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

Placeholder background-image has an invalid property #400

Closed
lennonpuype opened this issue Apr 3, 2024 · 2 comments
Closed

Placeholder background-image has an invalid property #400

lennonpuype opened this issue Apr 3, 2024 · 2 comments
Labels

Comments

@lennonpuype
Copy link

lennonpuype commented Apr 3, 2024

Describe the bug

We want to show the image as placeholder using the loading() and placeholder() methods on the pictureTag.

My setup

I just did a simple render of an image an turned on the placeholder option.
{{ asset.imageOptimize.pictureTag().placeholder('image').loading('lazy').render() }}

What is happening

The background-image style property has a value with a space inside and is ending with a : which are not allowed in that line. When these are gone, it works as expected:
Screenshot 2024-04-03 at 13 40 26

Versions

  • Plugin version: 5.0.0-beta.1
  • Craft version: 5.0.0
@lennonpuype lennonpuype added the bug label Apr 3, 2024
@khalwat
Copy link
Contributor

khalwat commented May 9, 2024

Wow, this was an interesting one. It's actually a bug in Craft's Html::tag() function, which inserts whitespace where it shouldn't be.

I filed an issue here: craftcms/cms#14964

khalwat added a commit that referenced this issue May 9, 2024
…utput and invalid `style` attribute for lazy loaded images ([#400](#400))
khalwat added a commit that referenced this issue May 9, 2024
…utput and invalid `style` attribute for lazy loaded images ([#400](#400))
khalwat added a commit that referenced this issue May 9, 2024
…utput and invalid `style` attribute for lazy loaded images ([#400](#400))
@khalwat
Copy link
Contributor

khalwat commented May 9, 2024

Fixed in the above commits.

Craft CMS 3:

You can try it now by setting your semver in your composer.json to look like this:

    "nystudio107/craft-imageoptimize": "dev-develop as 1.6.54”,

Then do a composer clear-cache && composer update

…..

Craft CMS 4:

You can try it now by setting your semver in your composer.json to look like this:

    "nystudio107/craft-imageoptimize": "dev-develop-v4 as 4.0.8”,

Then do a composer clear-cache && composer update

…..

Craft CMS 5:

You can try it now by setting your semver in your composer.json to look like this:

    "nystudio107/craft-imageoptimize": "dev-develop-v5 as 5.0.1”,

Then do a composer clear-cache && composer update

@khalwat khalwat closed this as completed May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants