While one finds little help in our query from Hume (because his account is clearly flawed) or from Locke (he doesn't even appear to recognize the issue), there is another empiricist who is more helpful, viz., Bertrand Russell.  In his The Analysis of Mind, Russell offers a distinctly RTM that clearly addresses the issue of what it is in virtue of which an image is a memory image.  Here is a clear statement of his position as it involves a particular example: