Skip to content
This repository has been archived by the owner on Aug 12, 2023. It is now read-only.

Custom sizes with different suffix names. #15

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

guins
Copy link

@guins guins commented Apr 19, 2018

Hi,
I modified your plugin with a slightly different approach. Have a look at my README file to understand the idea behind it.

@guins
Copy link
Author

guins commented Apr 19, 2018

@Wartybliggens with my approach, you can see the different image sizes in the media panel.

@fredrikekelund
Copy link
Owner

Hi @guins! I'm happy to see that the plugin is being used and forked for different purposes! The reasoning behind generating images with @2x, @3x suffixes is that Grav will pick up those as image variants, and those image variants will show up in the srcset attribute of <img>s in your templates. Perhaps that was clear already, but I wanted to underline the fact that these seem to be 2 different use cases.

Should we perhaps simply link to your plugin from the plugin's README for those that are looking to generate separate images from each image size?

@guins
Copy link
Author

guins commented Apr 20, 2018

Hi @fredrikekelund ! That's why I took the took the time to explain my use case. The PR was more to give you a heads up rather than convince you to change the actual behaviour.
I'm pretty sure some people might have the same scenario so a link could be a good idea :)

@bleutzinn
Copy link

@fredrikekelund and @guins, would it be possible to merge the two use cases into a single (this) plugin and select the 'mode' via a configuration option?

@fredrikekelund
Copy link
Owner

Alright @guins, good to know! I'd be happy to link up your plugin as a resource in the README. I would rather keep the two plugins separate though, seeing as the functionality is different enough.

Perhaps the ideal scenario would be for Grav to support some API for accessing the image variants directly, for instance an API where you could ask for the variant that best matches a particular width (eg. page.media["image.jpg"].variant("500w") would give you the variant closest to 500px in width).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants