Hi,
I think I follow what you want to do. I have to say I think that for the overhead, you might as well just resize and upload .... but still, here's what I think you could try (assuming GIF files):
First I assume $new_w and $new_h contain the width and height of the image after it is resized.
<?
$bgim = imagecreatefromgif("/path/to/image"); // This is the image to be resized
$smim = imagecreate($new_w,$new_h); // This is a memory allocation for the new image
$old_w = imagesx($bgim); // Get the source image's width
$old_h = imagesy($bgim); // Get the source image's height
imagecopyresized ($smim, $bgim, 0, 0, 0, 0, $new_w, $new_h, $old_w, $old_h); // Copy the source image file into the new image memory and resize
imagegif($smim); // Output the new smaller image
?>
NOTE: I have not tested this! You need the GD image library for it to work. Check http://www.php.net/manual/en/ref.image.php to read more about how to do that.
All the best,
Louis