Yup. That came be done by making it an external file that is included in the HTML.
Like in ASP we write where in filename we give name of files. The file's HTML code is copied to that position as it is. So put an img tag in that file and include that file.
Similar approach exists in PHP and ASP.NET
In ASP.net we make a file with .ascx extension and its included by registering it as a control. In this case the code is not placed as it is and this page can even have a seperate script ( ASP.NET pages have a single script for the entire page)