Recently I was working on a project where I am building a Site Directory that lists all top-level site collections and their first level sub sites. In addition, for each listing we wanted to display the site image and some other information. We encourage our users to change their site image and theme to make their sites their own, and many do.
The site images were displaying fine for those that typed absolute URLs into the Logo URL field; however, for the ones that were using relative URLs, those images were not rendering because they did not exist at that relative path on the site collection that was hosting the site directory.
I did some searching and found this great post that explains exactly how to derive the absolute URL from any relative URL in SharePoint:
Use the SPSite.MakeFullUrl() function:
public string MakeFullUrl( string strUrl )
Simply pass in the string of the relative URL and it returns you the absolute URL.
string imageUrl = site.MakeFullUrl("/_layouts/images/siteIcon.png");
Returns you the full absolute Url of the site image.