It may be better to generate the resized images in advance, so that they can be served immediately, rather than genearting and regenerating them every time they're needed.
Note that if you're using file-based sessions, only one image will be resized and served at a time, even if the browser makes several requests concurrently (because the session file gets locked by each script in turn), so if there are a lot then some of the requests make have to wait too long for their chance at the session file and hence to be run and the browser may give up on them and report the image as broken.