It's worth noting that -- unlike many of the image functions -- imagescale returns a new image resource and leaves the existing image resource untouched.
If you don't need the original image after generating a scaled version, remember to imagedestroy() it.