The code above worked just fine for me on IM 6.6.9.5 Q16 Mac OSX Tiger when I display test.gif in my browser. Perhaps you need to upgrade your IM. What version of IM are you using and on what platform?