Image loaded event

also adds the fix outlined in #1 and also adds an [editorconfig](http://editorconfig.org/) file to keep line spacing etc constant between contributors.