johannschopplich / kirby-blurry-placeholder

🖼 Blurry image placeholders for better UX
MIT License
65 stars 3 forks source link

Get placeholder data via API/KQL #26

Closed hansipete closed 1 year ago

hansipete commented 1 year ago

Is there any chance to use Kirby Query Language to get placeholder data?

I tried the following — It was a desperate shot in the dark and with no success :-)

...
photo: {
  query: "page.photos.toFiles.first",
  select: {
    url: true,
    placeholderUri: true,
    focus: true
  }
}

Maybe that's more of a KQL-Question on how to call fieldMethods in a query...

johannschopplich commented 1 year ago

I have added support for KQL. Glad you asked!

Usage should work as shown below. The placeholder and placeholderUri file methods are now accessible via KQL:

photo: {
  query: "page.photos.toFiles.first",
  select: {
    url: true,
    hash: "file.placeholderUri",
    focus: true
  }
}