Yes, you could use this (it might need a bit of modification for filename variables) anywhere.
I used it in the Catalogs module so my customer could upload pictures from his camera directly to the module.
The images were fixed on 640px width. (
example)
This simple method will overwrite the original image, so that one is lost.
The line:
$new_image->setNewFile($nuevo_sitio); sets the output file. So a new filename would create a resized copy.
The size of the image you can upload and resize depends a bit on your host. It takes pretty much memory and time to resize large images. My dev server had problems with really big (8mpx) images, where my host server didn't have problems.
Ruud