Inevitably, anything that provides dynamic dimensions based on a parameter will allow the end user to invoke a reasonable ("more than usual" number of CPU operations on the server, which may be a problem for you depending on what you are trying to achieve. Caching generated images like was proposed by Oliver, will help to avoid performing the same work twice, and must necessarily be part of any dynamic solution.
I think you need to think about how important dynamic size is. In each case, I was dealing with predefined sizes (large, small, medium, large, very large) worked fine. The same caching considerations are used, but there are much fewer possibilities for creating a large number of images. I usually created different image sizes when loading the image, but a solution for creating on demand, if not already, would be equally good.
Elliveny
source share