-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Retina images in combination with manual derivatives #1016
Comments
This is a bit gnarly and it's super hard to debug on my non-retina display. I really need a new computer! |
The problem should be reproducible anyway, even if the difference is hard to tell. Here's how I encountered the issue:
|
I've added a Hacktoberfest tag to see if we can get some help with this as I'm a bit stretched with other things at the moment. |
This one is hopefully addressed by my PR, so I think we just need to iron that issue out to be able to close this. Maybe this isn't that much of low hanging fruit either |
Pregenerated alternatives and alternatives that are generated using ImageMedium#derivatives now use the same underlying method, which should make things more predictable. |
I want to generate srcset attributes for the images I'm using so that they both scale down on small displays and up on retina displays. Grav's methodology for this seems logical enough, in a first sweep I appended "@2x" to the filenames, to get it working on retina displays. That worked fine. Then I wanted them to scale down as well, so I manually called the
derivatives
method as well. This made the images scale down on mobile, but it also put a limit on the maximum width, so that the largest source only had half the width of the original image.I'm not sure exactly where the flawed logic is here, but it seems to be in how the combination of
$alternatives
and$derivatives
is treated in thesrcset
method of theImageMedium
class (see here).The
$alternatives
array should probably either be emptied if we use the derivative method manually, or srcset shouldn't work exclusively with either the$alternatives
array or the$derivatives
arrayThe text was updated successfully, but these errors were encountered: