I would also like to programmatically know the path of a file that has been uploaded to a repository.
My purpose is to use an image in the header of a PDF file that I generate, using the tcpdf library that comes with Moodle.
I can specify an image to put in the header, if that image is under the {moodle root dir}/pix directory. For example:
require_once( $CFG->libdir . '/pdflib.php' );
...
$doc = new pdf;
$doc->setPrintHeader( true )
$doc->setHeaderData( 'pix/f/writer-48.png', 15, 'The title', 'The subtitle' );
...
But, what if I want to use an image that has been uploaded to, for example, the server repository?
I know the image is there. How do I determine a path to that image file that the tcpdf library will accept? I think that the file path I provide to TCPDF::setHeaderData() is supposed to be relative to the Moodle root directory.