Image preview mouseover throws "Uncaught ReferenceError: img is not defined"

Fix for Issue #3311

The `img` is changed to `$img` which should fix the issue.