If image optimization is the reason why you went for your solution, you might want check out the ImageKit plugin: ImageKit - An Asynchronous Thumbs API
It’s a commercial plugin ($25), but you can test it for free. It can also be combined with the ImageSet plugin for responsive image support (bundle of the two plugins is $40).