There are several helper to handle file path within a project. The here package can be useful to derive path from the root directory of a project
You can then use knitr::include_graphics or you can then create a wrapper function to include you image by name and the path would be prepended based on a variable.
Best way to achieve all these is to define your path and helper function in a setup chunk to use in your doc. There is no knitr option I believe for input file path of image - this is usually handle by the user.
Beware of using absolute path though when generating non standalone HTML document - your HTML doc must know how to reach the image. This is why often the images are place in a folder relative to the site root. For self_contained document this would be ok though.
I let you try