In a custom module I'm trying to display results from mysql DB based on items users selected in a form. One of the fields in the content type I'd like to display is an image associated with the node. This image appears to be housed in the table 'file_managed' in a field called 'filename' - or at least that's where the NAME of the file is located. I'm able to retrieve that field fine using SQL and joins and when I echo the result it shows the following (for example):
nameoffile.png
So I tried calling that with php using:
$icon = $row['filename'];
echo $icon; // works fine
$output .= '<img src="' . $icon . '" />';
And it just shows a blank image icon (not the image nameoffile.png).
So then I think well I must have the path wrong. So I dragged the image icon from the search results page (where it displays just fine) into a new tab and this is the URL I get:
http://pf.dev/sites/default/files/styles/thumbnail/public/PPP_CCYCL_CLP_ChrevonCycle_A_8Red.png
But of course I don't want to use an absolute path, esp. since this is on the dev. server.
So my question is this: how do I find the paths to my content type images so I can display them correctly in my custom module?