Could you please share more info? Like where you place that code, etc.? Anyway, code blocks are not supported in many locations, but you can use macros instead (HTML layout, Text/XML transformations, etc.) and then the code would look like this:
style='background-image: url("~/getattachment/{% CurrentDocument.GetValue("PageHeaderImage") |(identity)GlobalAdministrator%}.aspx")'