https://gist.github.com/4lejandrito/6d4f903e0a692b87344e8600...
The resize function only resizes the first time and uses a cached version of the image after that.
I checked the server and the CPU is not too high so I think it must be HTTP as parent pointed out.
Ignore my comments, then.
Ignore my comments, then.