What can cause an incorrect base_url to intermittently appear for images?
I have had a very similar issue before.

Basically, the problem I had was that the image path was saved as  url, instead of being a relative path. If this is the case, the fix is fairly simple, simply go look at that node's attributes in the database, and change the url path to a relative paths.

If you are in doubt, a quick and dirty way to see if this is really the problem:


Do a DB dump, with mysqldump or whatever you use,
grep in that file for "http://localhost" 

grep -b3 -a3 "http://localhost" yoursqlfile.sql


The b and a flag are for the number of lines returned upon a text match before and after the match it is optional and can be tweaked to higher values if wanted/needed.



Now, if there is any reference in the sql data pointing to  your http://localhost, in your node meta-data these 2 simple steps will quickly help identify where the offending nodes are.  Just note the table and field names that grep found &amp; the nid's and go change the values to relative paths using either the commandline, a script or php-myadmin!

Of course, there are many ways to do this I just pointed out a very general way of fixing your data so it is portable.

Good-luck, happy coding.