-
-
Notifications
You must be signed in to change notification settings - Fork 186
Add asset methods for plugins #4989
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
Add asset methods for plugins #4989
Conversation
|
hey, any update on this PR? is this something you generally don't want, or have you just not found the time to look at it yet? |
lukasbestle
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay, we were indeed quite busy with 3.9 and 3.9.1. We haven't forgot about your other PR either, but it's going to take a bit of time to review.
I really like the idea of asset methods. I'd say they fit in quite well conceptually. Image methods would have an overlap with the existing file methods, but asset methods are really separate and useful on their own.
afbora
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loved new methods 💛
This PR …
Adds asset methods that work similar to file methods or page methods, just for use with the
Kirby/Filesystem/Assetclass that's e.g. used by theasset()helper.Why is this important?
There are many plugins out there that can e.g. apply image transforms such as johannschopplich/kirby-blurry-placeholder or my own kirby-blurhash that one might want to use on a static image, but they only work conveniently with Kirby files itself due to file methods not being supported for simple assets.
See also: johannschopplich/kirby-blurry-placeholder#15
This should also be in favor of Kirby, as the docs state: "Anything in your public path can be converted to an Asset object to use the same handy file methods as for any other Kirby files."
They obviously can't be allowed access to regular custom file methods, as those might access properties only available on the
Fileobject.What else to consider?
An alternative to this could be to allow
imageMethodswhich extend theKirby/Image/Imageclass. They would automatically inherit to assets and image files, but thus also allow less customization due to the lack of access to e.g.mediapath info.Breaking changes
None.
Ready?
For review team