I have the same issue as Start1.
if(im.length>1) img=im.replace(/^\s+/,"");//ltrim - a white space creeps out in the left; maybe regexe's fault ?
The problem seems to be that
null at this point ant it cannot call the method length on null object.
Maybe just a simple test on im would solve the issue !
However, on another blog, I use WP 3.4 and the version 1.4.1 of your plugin. This work correctly !