Depends what “dealing with images” means. Just showing an image when the original HTML says <img src="something.jpg" alt="">?
In my case I have a rather specific setup where I don’t use numbered page folders, and I’m serving the content folder as my web root, so /some/page/something.jpg serves the content/some/page/something.jpg file directly. I’m “only” using Kirby to render a page if the request did not match an existing file.
In a more standard setup, you could rewrite the HTML, using a list of known files:
<?php
// Output the HTML source, replacing "image.jpg" with e.g. "/content/page/image.jpg"
if ($content = $page->contentfile()->toFile()) {
$fileMap = [];
foreach($page->files() as $file) {
$fileMap[ $file->filename() ] = $file->url();
}
$html = str_replace(
array_keys($fileMap),
array_values($fileMap),
$content->read()
);
$content->headers();
echo $html;
}