finding the url(path) of images via their fID

Permalink
Hello, everyone. I already posted about this issue but couldn't achieve what i needed.
So here is my problem i have a file mobile.php that is an external page of a Concrete5 website this page have an <?php include('connect.php');?> that allows it to connect to the website's database.
However my problem is that in the said db there is not the actual path to images that i need to be automatically displayed on the mobile.php. I have to use the fIDs of the images to get their URL
So far i think that i should use something like

$ih = Loader::helper('image');
$img = File::getByID($fID);
$imagePath = $img->getURL();

and then echo the $imagePath into the src of the image however when i enter any code related to Concrete5 the code just stop there and displays nothing.

So my questions are where exactly should i put this code? on the same file or in an external one? In order that my file understands it should it be connected to Concrete5? I'am just using define("C5_EXECUTE", true); on the top of the page is that enough?

Thanks

 

This website stores cookies on your computer. These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media. To find out more about the cookies we use, see our Privacy Policy.