Microsoft Office SharePoint Server (MOSS) 2007 provides a simple way for power users to create a customized site and save it as a site template file (STP) to reuse on the site. By default, the template is installed in the Template Gallery for the site collection.
Master pages are heavily used in SharePoint 2007. Master pages provide a central point for configuring look and feel, among other things. However, graphic files can be a sticking point in master pages used in templates. Since the template files may be attached to multiple servers, absolute links to images stored in a central repository may not work in a different environment. Similarly, relative links to images may have variable paths since the pages that call the master page can live at different levels in the hierarchy – for example, default.aspx and list edit pages.
So this kind of image link can be problematic:
<img src="MyLogo.png">
Unless you go about putting copies of your graphic file in every directory of your site, this lihnk won’t work consistently.
So let’s assume that you have a Picture Library already created on your site, called “Site Images”, and you’ve added your logo file there. Two tricks can help. The first is the runat tag. This tag tells the server the interpret the link on the server relative to the location of the master page, not the actual page itself, so the link will be interpreted consistently throughout the site.
The second is using the ".." relative reference to move up a level. Since master pages, by default, are stored in the /_catalogs/masterpage directory, two iterations of this will get us back to the root of the site. And we wind up with the following link code:
<img src="../../SiteImages/MyLogo.png" runat="server">