I have encountered the same during the beta’s. I’m convinced the Kirby team will come up with something which makes this possible soon.
You can however already use the Darkroom factory to generate thumbnails, but in my experience you’ll have to redo a lot of the things Kirby otherwise does for you.
For the time being, I would glady define global images / etc in the settings page, but this isn’t editable either - so how would I go about just grabbing an image from the assets folder, resize and output it, say, in my header snippet?
Woaw, after searching for so long, I finally found an answer with this post: it’s currently not possible to get an Image object from the assets folder… =’)
The documentation is quite vague about assets in general, I haven’t even found the default path to the assets folder anywhere (it should at least be noted in the $kirby->url('assets') documentation I think), I just know it from Kirby 2.
I think it would be quite nice if we could do $kirby->asset('images/myimage.png') to get the corresponding File object, but then it would be necessary to have a method to get the Image object I guess.
Anyway, I hope this will soon be updated, thanks for the great work!
@texnixe This solution has worked for me, but breaks when I try and combine it with the CDN setup described in the cookbook. The new asset breaks the file::version component returning the following error:
Argument 2 passed to Kirby\Toolkit\F::{closure}() must be an instance of Kirby\Cms\File, instance of Kirby\Cms\Asset given, called in /Users/max/Sites/prism/kirby/src/Cms/FileModifications.php on line 194
Please let me know if you see an easy way around this. Thanks!
@texnixe thanks for the help. that fixes the error and allows the CDN link to be generated. However the image asset does not show up in the kirby /media folder. So the CDN can’t to pull it in. Any thoughts on how to handle that?
As a workaround, I’m making an assets folder within the content folder content/assets and hide it from the panel. This way I can access images with the standard Kirby tools and the CDN plugin should work as expected. Seems fine this way!