First, I’ll link this discussion because there is some relevant stuff in there:
This gives us some limitations, but also opportunities. Let’s say all your images are found in path/. Then you can create a file path/images.typ and define the following function there:
a call to this (not the builtin) image function will automatically treat the file path relative to the path/images.typ file!
What I usually do has a similar result, but I actually try to avoid to even use image paths across the whole project. Instead I define helper functions for my assets:
#let logo = image.with("logo.svg")
#let banner = image.with("banner.jpg")
Then I call these like assets.logo(height: 2cm). For the kinds of images I use in my documents that feels more useful to me, but it’s definitely an opinionated solution.
Your method to define helper-functions only makes sense if you have not so many images and they appear multiple times and less sense if you have many images which all appear only once, doesn’t it? (Or are there some advantages, which I don’t realize?)
Absolutely, that’s what I meant with “it’s definitely an opinionated solution”: it works well for my use cases, not for others. If you have logos or other assets that you reuse a lot, it’s a good tool to have; if you have images that you each include once, it’s pretty useless.
Edit: As SillyFreak points out below, the code in this post does not apply to the situation he describes. However, it does apply if you put it in your main .typ file since then the path from the file to the photos begins outside of “path/” and therefore it needs to be added.