fabianmichael / kirby-meta

All-in-one solution to all of your SEO/OpenGraph/JSON-LD needs. 👀
MIT License
65 stars 8 forks source link

Use thumb presets for easier thumbnail customisation #29

Closed Daandelange closed 1 year ago

Daandelange commented 1 year ago

Hello (again),
[sorry for posting quite some issues, I'm implementing your plugin and thinkering at the same time :) ]

Context:
I'm using a custom thumb driver to customise how thumbs are generated generally and would like to use it to customise the OG image thumb too. Long story short, this is way more easy and robust using thumb presets when calling $file->thumb() (otherwise requiring to check the thumb settings argument against known preset values).

Motivation:
Be it with or without custom thumb driver, I think there are situations where one wishes customise the thumb function used by this plugin, and it would be possible if it registers and uses a thumb preset rather then hardcoded thumb parameters. (example: change the thumb quality for the og-image). This will also make it easier to generate an og-image-thumb manually from usercode by providing a specific preset.

Sure, this is already possible with the hooks by removing the corresponding thumb tags and generating a thumb again to put it back as a html tag, but that feels heavy.

Proposal:
So I'm asking to make the OG image thumb easier to customise/hook-up by switching from hardcoded thumb parameters to a thumb preset.

  1. Register a thumb preset
  2. Modify all calls to thumb()
Daandelange commented 1 year ago

Two issues for the implementation, which make them more difficult to maintain.

fabianmichael commented 1 year ago

@Daandelange No need for that, there’s already an API for overriding the deafult og:image of a page. I just added it to the docs: https://github.com/fabianmichael/kirby-meta#providing-metadata-from-page-models

Daandelange commented 1 year ago

Awesome, thanks ! :)