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

Make WidthStep and MaxWidth overridable via helper & service #55

Open
lars-erik opened this issue Jun 8, 2023 · 7 comments
Open

Make WidthStep and MaxWidth overridable via helper & service #55

lars-erik opened this issue Jun 8, 2023 · 7 comments
Milestone

Comments

@lars-erik
Copy link

It'd be nice to be able to specify a "slimmer" srcset in specific use cases.
If I understand the code correctly, there's only one SlimsyOptions with settings for WidthStep and MaxWidth, and you'd have to create the service manually to do it differently.

Maybe as simple as making those two optional parameters all the way. I think the remaining config options are already overridable?

@Jeavon Jeavon added this to the v4.1.0 milestone Jun 15, 2023
@Jeavon
Copy link
Owner

Jeavon commented Jun 20, 2023

Should also add parameters to the tag helper to pass these through for specific instances

@Jeavon
Copy link
Owner

Jeavon commented Jun 22, 2023

Thinking about the tag helper and the many options we now have, for v5 we are going to introduce "Config Presets"

@lars-erik
Copy link
Author

Thinking about the tag helper and the many options we now have, for v5 we are going to introduce "Config Presets"

Nice! So we can do "small image with 3 steps" and "large photo with 7 steps" like the crop aliases?

@Jeavon
Copy link
Owner

Jeavon commented Jun 22, 2023

@lars-erik yes exactly, something like:

   "TagHelper": {
      "Presets": [
        {
          "Alias": "SpecialImportant",
          "PictureSources": [
            {
              "Extension": "webp",
              "Quality": 100,
              "LQIPQuality":20
            },
            {
              "Extension": "avif",
              "Quality": 100,
              "LQIPQuality":10
            },
            {
              "Extension": "jpg",
              "Quality": 100
              "LQIPQuality":20
            }
          ],
          "WidthStep": 60,
          "MaxWdith": 3000,
          "UseCropAsSrc": true,
          "ImageDimensions": true
        },
        {
          "Alias": "NormalImage",
          "PictureSources": [
            {
              "Extension": "webp",
              "Quality": 70
              "LQIPQuality":20
            },
            {
              "Extension": "avif",
              "Quality": 60
              "LQIPQuality":10              
            },
            {
              "Extension": "jpg",
              "Quality": 70
              "LQIPQuality":20              
            }
          ],
          "WidthStep": 160,
          "MaxWdith": 3000,
          "UseCropAsSrc": true,
          "ImageDimensions": true
        }
      ]
    }

What do you think?

@lars-erik
Copy link
Author

Awesome!

How about quality for placeholder image that's there before lazysizes kicks in?

On a sidenote, I had an interesting dicussion with @bjarnef about how to make "the" image above the fold not lazy loaded. (think block grid)
No big conclutions. 🙈

@Jeavon Jeavon modified the milestones: v4.1.0, v5.0.0 Jun 23, 2023
@Jeavon
Copy link
Owner

Jeavon commented Jun 23, 2023

I've added LQIPQuality to the above config concept.

On the question of not lazy loading the first image, we think we can generate a sizes attribute with a new method, something like @Url.GenerateSizesForEagerLoad() but you would still need to figure out in your own logic which image should use this method instead of lazy load, interesting in block grids etc.....

@sekmenhuseyin
Copy link

Hi @Jeavon
is it possible to get this output with Slimsy, I've tried every option but couldn't find a way
image
image

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

No branches or pull requests

3 participants