So you basically want to 'bubble-up' your tree till you find a page that has data in this field?
I would create a dedicated Custom Web Part for this so you can do it directly in code. If it's a macro in generic location you could look into creating a custom macro. This way it's still in code but you can use it throughout the whole system.
In case you can't or won't want to update code you could use a while loop in a macro:
{%
curDoc = CurrentDocument;
imgBackground = "";
while( curDoc != null)
{
imgBackground = curDoc.GetValue("YourField", "");
if(!String.IsNullOrWhiteSpace(imgBackground))
{
return(imgBackground);
}
curDoc = curDoc.Parent;
}
return "guess it's empty";
|(identity)GlobalAdministrator%}
Not fool proof yet, but should get you started. Remember this isn't efficient at all and I would recommend to at least cache the page or part of the page this is rendered on.