Move img handler outside of class, added classes to simulate the socket

This should allow the handler to be reused for image preloading/scraping